From 60fdbb8ac43528be16f90671bb65b9512b0bc337 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 14 Jun 2024 19:54:06 +0600 Subject: [PATCH] small improvement in BehaviourContext --- .../extensions/behaviour_builder/BehaviourContext.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 d6131aac84..1f96aef8cd 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 @@ -132,6 +132,8 @@ fun BC.createSubContext( /** * Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext] + * + * [this] [BehaviourContext] will **NOT** be closed automatically */ suspend fun BC.doInContext( behaviourContextReceiver: CustomBehaviourContextReceiver @@ -152,12 +154,10 @@ suspend fun BC.createSubContextAndDoWithUpdatesFilter ): T { return supervisorScope { createSubContext( - scope = this, + scope = this@supervisorScope, triggersHolder = triggersHolder, updatesUpstreamFlow = updatesUpstreamFlow - ).doInContext( - behaviourContextReceiver = behaviourContextReceiver - ) + ).behaviourContextReceiver() } }