Skip to content

Commit

Permalink
Merge pull request #9 from tkey/fix/release-lock
Browse files Browse the repository at this point in the history
fix: Ensure write metadata lock is released
  • Loading branch information
huggingbot authored May 7, 2024
2 parents 9319136 + b5f54d0 commit a9b4f10
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a9b4f10

Please sign in to comment.