Skip to content

Commit 98bdb14

Browse files
NikaHsnNika Hassani
andauthored
fix(datastore): make event history list thread safe (#3509)
Co-authored-by: Nika Hassani <[email protected]>
1 parent aafc570 commit 98bdb14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DataStoreHubEventStreamHandler : EventChannel.StreamHandler {
3838
private var forwardHubResponse: (event: Map<String, Any>) -> Unit
3939

4040
// DataStore hub event history. Used to track events which may be lost on hot restart, such as sync and ready events.
41-
private var eventHistory: MutableList<HubEvent<*>> = mutableListOf()
41+
private var eventHistory: MutableList<HubEvent<*>> = java.util.Collections.synchronizedList(mutableListOf())
4242

4343
// Event types which should be replayed on hot restart.
4444
private val replayEvents: Set<String> = setOf(

0 commit comments

Comments
 (0)