Concurrency test

This commit is contained in:
Avently
2022-12-15 14:01:03 +03:00
parent 1ab0f55ef1
commit 911dd0c2ef

View File

@@ -87,6 +87,22 @@ fun ChatView(chatId: String, chatModel: ChatModel, onComposed: () -> Unit) {
.filter { it?.chatInfo != activeChat.value?.chatInfo && it != null }
.collect { activeChat.value = it }
}
launch {
launch(Dispatchers.IO) {
while (true) {
chatModel.chats.add(Chat.sampleData.copy(chatInfo = activeChat.value!!.chatInfo))
delay(1)
chatModel.chats.remove(Chat.sampleData.copy(chatInfo = activeChat.value!!.chatInfo))
}
}
launch(Dispatchers.IO) {
while (true) {
chatModel.chats.add(Chat.sampleData.copy(chatInfo = activeChat.value!!.chatInfo))
delay(1)
chatModel.chats.remove(Chat.sampleData.copy(chatInfo = activeChat.value!!.chatInfo))
}
}
}
}
val view = LocalView.current
if (activeChat.value == null || user == null) {