small improvement in AccumulatorFlow

This commit is contained in:
InsanusMokrassar committed 2024-12-04 10:16:19 +06:00
1 parent b915f6ece2
commit 18c608f569
2 files changed
+5 -2

No files matched your search

+3
View File
@@ -2,6 +2,9 @@
## 0.23.2
* `Coroutines`:
* Small refactor in `AccumulatorFlow` to use `runCatching` instead of `runCatchingSafely`
## 0.23.1
* `Versions`:
@@ -68,9 +68,9 @@ class AccumulatorFlow<T>(
override suspend fun collectSafely(collector: FlowCollector<T>) {
val channel = Channel<T>(Channel.UNLIMITED, BufferOverflow.SUSPEND)
steps.send(SubscribeAccumulatorFlowStep(channel))
val result = runCatchingSafely {
val result = runCatching {
for (data in channel) {
val emitResult = runCatchingSafely {
val emitResult = runCatching {
collector.emit(data)
}
if (emitResult.isSuccess || emitResult.exceptionOrNull() is CancellationException) {