1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

Update BehaviourContextWithFSM.kt

This commit is contained in:
InsanusMokrassar 2022-12-29 08:12:02 +06:00
parent dbe2607994
commit 90ad34f114

View File

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