From 86bd5eaa07df6d233be0ff4034c0d5f44ba2eb65 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 14 Jun 2024 17:33:51 +0600 Subject: [PATCH] fill changelog and change BehaviourContext updates flow subscription mechanism --- CHANGELOG.md | 14 ++++++++++---- .../behaviour_builder/BehaviourContext.kt | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c722f9c968..d4c098a3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,16 @@ ## 14.0.2 * `Version`: - * `Coroutines`: `1.8.0` -> `1.8.1` - * `Ktor`: `2.3.10` -> `2.3.11` - * `MicroUtils`: `0.20.45` -> `0.20.52` - * `KSLog`: `1.3.3` -> `1.3.4` + * `Coroutines`: `1.8.0` -> `1.8.1` + * `Ktor`: `2.3.10` -> `2.3.11` + * `MicroUtils`: `0.20.45` -> `0.20.52` + * `KSLog`: `1.3.3` -> `1.3.4` +* `BehaviourBuilder`: + * `BehaviourContext` updates listening job will be weakly subscribed. It means that `BehaviourContext` scope will + not be prevented from cancelling by this job anymore + * `BehaviourContext.doInContext` will not stop automatically current `BehaviourContext` job anymore + * `BehaviourContext.createSubContextAndDoWithUpdatesFilter` will use `supervisorScope` instead of + `LinkedSupervisorScope`. That will prevent scope leaking in runtime ## 14.0.1 diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt index 331de9ca6d..d6131aac84 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt @@ -87,7 +87,7 @@ class DefaultBehaviourContext( } else { it } - }.accumulatorFlow(scope) + }.accumulatorFlow(WeakScope(scope)) override val asUpdateReceiver: UpdateReceiver = additionalUpdatesSharedFlow::emit override fun copy(