We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 417e6c6 commit 55d5d8eCopy full SHA for 55d5d8e
util/src/main/kotlin/com/caplin/integration/datasourcex/util/flow/Buffer.kt
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.channelFlow
11
import kotlinx.coroutines.flow.produceIn
12
import kotlinx.coroutines.selects.onTimeout
13
import kotlinx.coroutines.selects.whileSelect
14
+import kotlinx.coroutines.yield
15
16
/**
17
* Buffers all elements emitted until there is a period of no emissions greater than
@@ -35,6 +36,7 @@ fun <T> Flow<T>.bufferingDebounce(timeoutMillis: Long): Flow<List<T>> = channelF
35
36
if (bufferedItems.isNotEmpty()) {
37
send(bufferedItems)
38
bufferedItems = mutableListOf()
39
+ yield()
40
}
41
it?.let { throw it }
42
0 commit comments