From b5f54d0dc520d12402a098a0ecf5a0a22354650d Mon Sep 17 00:00:00 2001 From: weechien <83656073+huggingbot@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:42:27 +0800 Subject: [PATCH] [IRT-1265] fix: Ensure write metadata lock is released --- packages/core/src/core.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index a1bc5a31..2f444bbe 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -1429,14 +1429,14 @@ class ThresholdKey implements ITKey { privKey: this._localMetadataTransitions[0], serviceProvider: this.serviceProvider, }); + this._localMetadataTransitions = [[], []]; + this.lastFetchedCloudMetadata = this.metadata.clone(); } catch (error: unknown) { throw CoreError.metadataPostFailed(prettyPrintError(error as Error)); + } finally { + // release lock + if (acquiredLock) await this.releaseWriteMetadataLock(); } - - this._localMetadataTransitions = [[], []]; - this.lastFetchedCloudMetadata = this.metadata.clone(); - // release lock - if (acquiredLock) await this.releaseWriteMetadataLock(); } // Returns a new instance of metadata with a clean state. All the previous state will be reset.