1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-29 13:38:43 +00:00

Update BehaviourContextWithFSM.kt

This commit is contained in:
InsanusMokrassar 2022-12-29 08:12:02 +06:00 committed by GitHub
parent c193b512d9
commit 887c51f83a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,8 +173,10 @@ class DefaultBehaviourContextWithFSM<T : State>(
fun Job.enableRemoveOnCompletion(state: T) { fun Job.enableRemoveOnCompletion(state: T) {
invokeOnCompletion { invokeOnCompletion {
launchSafelyWithoutExceptions { launchSafelyWithoutExceptions {
if (this@enableRemoveOnCompletion === statesJobs[state]) { statesJobsMutex.withLock {
statesJobs.remove(state) if (this@enableRemoveOnCompletion === statesJobs[state]) {
statesJobs.remove(state)
}
} }
} }
} }