unlock #

Available since 2.9.0
Deprecated since 2.57.0

Mutex is deprecated since 2.57.0: use withLock instead. Both take the same Redis key, so a Mutex and a withLock call on the same resource exclude each other, and call sites can be migrated one at a time.

Frees the locked resource, making it available again.

unlock(): Promise<void>

Returns #

Returns a promise, resolved once the mutex has been unlocked.

Throws #

Throws a core.fatal.assertion_failed error if this mutex instance does not hold the lock.

Once the node is shutting down, Kuzzle frees every lock still held before it exits: unlock() on such a lock resolves without doing anything.