Skip to content

Commit 417e6c6

Browse files
committed
minor improvements
1 parent 68b0440 commit 417e6c6

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ 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
1514

1615
/**
1716
* Buffers all elements emitted until there is a period of no emissions greater than
@@ -36,7 +35,6 @@ fun <T> Flow<T>.bufferingDebounce(timeoutMillis: Long): Flow<List<T>> = channelF
3635
if (bufferedItems.isNotEmpty()) {
3736
send(bufferedItems)
3837
bufferedItems = mutableListOf()
39-
yield()
4038
}
4139
it?.let { throw it }
4240
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun <T, K, R> Flow<T>.demultiplexBy(
4545
keyResponseChannels[key] = keyResponseChannel
4646
flow { flowProducer(key, keyResponseChannel.consumeAsFlow()) }
4747
.onEach { response -> send(response) }
48-
.onCompletion { completedKeysChannel.trySend(key) }
48+
.onCompletion { completedKeysChannel.send(key) }
4949
.launchIn(this@callbackFlow)
5050
}
5151
}

0 commit comments

Comments
 (0)