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

View File

@ -22,12 +22,14 @@ class EventNotificationConsumer(private val applicationContext: Context) {
fun consume(event: Event) {
val scope = CoroutineScope(Job() + Dispatchers.IO)
scope.launch {
// adds to database
LocalCache.verifyAndConsume(event, null)
if (LocalCache.notes[event.id] == null) {
// adds to database
LocalCache.verifyAndConsume(event, null)
when (event) {
is PrivateDmEvent -> notify(event)
is LnZapEvent -> notify(event)
when (event) {
is PrivateDmEvent -> notify(event)
is LnZapEvent -> notify(event)
}
}
}
}