safe-redis-leader

JSON →
library 0.0.6 ·javascript
verified Jun 7, 2026

A safe leader election implementation for Node.js using Redis, designed to eliminate race conditions present in the original 'redis-leader' package (v0.0.6, latest). It uses async/await, removes CommonJS callback patterns, and provides a factory function 'createSafeRedisLeader' instead of requiring 'new'. The library is a rewrite that fixes known bugs in prior implementations, includes a test suite with Docker Compose, and focuses on correctness without external dependencies beyond ioredis. It offers events like 'elected' and methods 'elect' and 'stop', suitable for distributed systems needing reliable single-leader guarantees.