Adds another check to make sure the event does not exist in the local memory before notifying.

This commit is contained in:
Vitor Pamplona
2023-06-09 16:41:14 -04:00
parent bf6bc5ba68
commit 267b5e474c
@@ -22,6 +22,7 @@ class EventNotificationConsumer(private val applicationContext: Context) {
fun consume(event: Event) {
val scope = CoroutineScope(Job() + Dispatchers.IO)
scope.launch {
if (LocalCache.notes[event.id] == null) {
// adds to database
LocalCache.verifyAndConsume(event, null)
@@ -31,6 +32,7 @@ class EventNotificationConsumer(private val applicationContext: Context) {
}
}
}
}
private fun notify(event: PrivateDmEvent) {
val note = LocalCache.notes[event.id] ?: return