Node distributed locking using Redis with atomic Lua scripts. Current stable version 1.3.0. Low release cadence (last update years ago). Differentiator: uses SET key uuid PX timeout NX for acquire and Lua scripts for release/extend, avoiding race conditions without requiring dedicated Redis connections. Supports callbacks, promises (bluebird), and co. Compatible with Redis >= 2.6.12. Provides LockAcquisitionError, LockReleaseError, LockExtendError for error handling.
npm install redislockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Redis lock with timeout, retries, and delay, acquires it, performs work, and releases it using async/await.
Set timeout sufficiently high to cover the longest expected operation under the lock.
Design critical sections to not re-enter the same lock, or use a different pattern.
Evaluate alternatives like redlock or ioredis's built-in locking.
Increase retries or delay, release other locks, or check Redis connectivity.
Ensure the lock is still held and Redis is available; handle errors gracefully.
Use node_redis (redis) package for compatibility with redislock.