From 960fee4050fd9ac6b4bd63e158e4c7f847864807 Mon Sep 17 00:00:00 2001 From: Nika Hassani Date: Wed, 2 Aug 2023 14:56:35 -0700 Subject: [PATCH] fix(datastore): make event history list thread safe --- .../amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt index 77417417c9..c04ef90a90 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt @@ -38,7 +38,7 @@ class DataStoreHubEventStreamHandler : EventChannel.StreamHandler { private var forwardHubResponse: (event: Map) -> Unit // DataStore hub event history. Used to track events which may be lost on hot restart, such as sync and ready events. - private var eventHistory: MutableList> = mutableListOf() + private var eventHistory: MutableList> = java.util.Collections.synchronizedList(mutableListOf()) // Event types which should be replayed on hot restart. private val replayEvents: Set = setOf(