mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-01 22:40:07 +00:00
Update BehaviourContextWithFSM.kt
This commit is contained in:
parent
c193b512d9
commit
887c51f83a
@ -173,12 +173,14 @@ class DefaultBehaviourContextWithFSM<T : State>(
|
|||||||
fun Job.enableRemoveOnCompletion(state: T) {
|
fun Job.enableRemoveOnCompletion(state: T) {
|
||||||
invokeOnCompletion {
|
invokeOnCompletion {
|
||||||
launchSafelyWithoutExceptions {
|
launchSafelyWithoutExceptions {
|
||||||
|
statesJobsMutex.withLock {
|
||||||
if (this@enableRemoveOnCompletion === statesJobs[state]) {
|
if (this@enableRemoveOnCompletion === statesJobs[state]) {
|
||||||
statesJobs.remove(state)
|
statesJobs.remove(state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statesManager.onStartChain.subscribeSafelyWithoutExceptions(this) {
|
statesManager.onStartChain.subscribeSafelyWithoutExceptions(this) {
|
||||||
statesJobsMutex.withLock {
|
statesJobsMutex.withLock {
|
||||||
|
Loading…
Reference in New Issue
Block a user