Only call flows when there are new events to process.

This commit is contained in:
Vitor Pamplona
2023-10-25 14:29:08 -04:00
parent 4aaf25a384
commit 4a8c020c3d
@@ -81,13 +81,17 @@ class BundledInsert<T>(
try {
val mySet = mutableSetOf<T>()
queue.drainTo(mySet)
if (mySet.isNotEmpty()) {
onUpdate(mySet)
}
delay(delay)
val mySet2 = mutableSetOf<T>()
queue.drainTo(mySet2)
if (mySet2.isNotEmpty()) {
onUpdate(mySet2)
}
} finally {
withContext(NonCancellable) {
onlyOneInBlock.set(false)