Skip to content

Commit 55d5d8e

Browse files
committed
Put the yield back
1 parent 417e6c6 commit 55d5d8e

File tree

1 file changed

+2
-0
lines changed
  • util/src/main/kotlin/com/caplin/integration/datasourcex/util/flow

1 file changed

+2
-0
lines changed

util/src/main/kotlin/com/caplin/integration/datasourcex/util/flow/Buffer.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.channelFlow
1111
import kotlinx.coroutines.flow.produceIn
1212
import kotlinx.coroutines.selects.onTimeout
1313
import kotlinx.coroutines.selects.whileSelect
14+
import kotlinx.coroutines.yield
1415

1516
/**
1617
* 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
3536
if (bufferedItems.isNotEmpty()) {
3637
send(bufferedItems)
3738
bufferedItems = mutableListOf()
39+
yield()
3840
}
3941
it?.let { throw it }
4042
}

0 commit comments

Comments
 (0)