From abbb4e2dff4b5f42976a25ecb0125ee9c172b351 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 16 Jun 2024 22:34:44 +0600 Subject: [PATCH] update microutils --- gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- .../dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index fa5adf3574..81d95ddd65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=14.0.2-preview5 +library_version=14.0.2-preview6 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b3a4ad3455..6d62212c3d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ ktor = "2.3.11" ksp = "1.9.23-1.0.20" kotlin-poet = "1.16.0" -microutils = "0.20.53" +microutils = "0.20.53-preview1" kslog = "1.3.4" versions = "0.51.0" diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index 23c8fa19ee..261d23379b 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.extensions.api import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob +import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup @@ -54,8 +55,9 @@ suspend fun TelegramBot.handleLiveLocation( val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations null } else { - CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { - while (isActive) { + val scope = currentCoroutineContext().LinkedSupervisorScope() + scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { + while (scope.isActive) { delay(liveTimeMillis) // Remove previous location message info to resend live location message currentLiveLocationMessage = null