Commit 63478b81 authored by travis79's avatar travis79
Browse files

Fix for IndexOutOfBounds exceptions raised by Glean

parent ace876b0
......@@ -200,13 +200,19 @@ internal object EventsStorageEngine : StorageEngine {
*
* @return the list of events recorded in the requested store
*/
@Synchronized
fun getSnapshot(storeName: String, clearStore: Boolean): List<RecordedEventData>? {
// Rewrite all of the timestamps to they are relative to the first
// timestamp
val events = eventStores[storeName]?.let { store ->
val firstTimestamp = store[0].timestamp
store.map { event ->
event.copy(timestamp = event.timestamp - firstTimestamp)
if (store.size == 0) {
logger.error("Unexpectedly got empty event store")
null
} else {
val firstTimestamp = store[0].timestamp
store.map { event ->
event.copy(timestamp = event.timestamp - firstTimestamp)
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment