From 2b7e9534f3ea695c8b194a8d01bb7fea13198fe5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 28 Jun 2021 00:31:46 +0600 Subject: [PATCH] hotfix --- CHANGELOG.md | 7 +++++-- .../inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb819502ba7..e90a7e97b92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ # Changelog -## 0.5.15 +## 0.5.15 HOTFIX FOR 0.5.14 -## 0.5.14 +* `Coroutines` + * Fixes in `subscribeAsync` + +## 0.5.14 NOT RECOMMENDED * `Versions` * `Kotlin`: `1.5.10` -> `1.5.20` diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt index 0a3019f6009..7bde7300015 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt @@ -38,7 +38,7 @@ private data class AsyncSubscriptionCommandData( override suspend fun invoke(markersMap: MutableMap>) { val marker = markerFactory(data) markersMap.getOrPut(marker) { - SubscribeAsyncReceiver(scope) { + SubscribeAsyncReceiver(scope.LinkedSupervisorScope()) { safelyWithoutExceptions { block(it) } if (isEmpty()) { onEmpty(marker) @@ -80,7 +80,7 @@ fun Flow.subscribeAsync( actor.send(dataCommand) } - job.invokeOnCompletion { subscope.cancel() } + job.invokeOnCompletion { if (subscope.isActive) subscope.cancel() } return job }