From 5dcea0b990c28025daef73c9df552664c44839be Mon Sep 17 00:00:00 2001 From: Delusoire Date: Sat, 10 Aug 2024 05:57:32 +0100 Subject: [PATCH] fix: dead lock --- module.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/module.ts b/module.ts index 8830429..bc1dab0 100644 --- a/module.ts +++ b/module.ts @@ -267,9 +267,16 @@ export class Module extends ModuleBase { } public async fastEnable(instance: ModuleInstance): Promise { - return instance.transition.new(async () => { - const enabledInstance = this.getEnabledInstance(); + let enabledInstance = this.getEnabledInstance(); + if (enabledInstance === instance) { await enabledInstance?.transition.block(); + } + + return instance.transition.new(async () => { + enabledInstance = this.getEnabledInstance(); + if (enabledInstance !== instance) { + await enabledInstance?.transition.block(); + } if ( instance.isEnabled() ||