locky
Run a process accross multiple machines.
options
var worker = 'process name' ttl: 5 * 1000 redis: port: '6379' host: '127.0.01' ;
- ttl: when process exits without releasing the lock, how much time to wait to release the lock
- redis: follows node-redis.createClient.
API
worker.lock();
Try to get a lock for this worker.
worker.release();
Release the lock for the current worker.
worker.end();
Stop (without releasing) worker redis connection. It's up to you to release the worker before end.
worker.on('lock');
Emitted when the worker managed to get the lock as a master.
worker.on('conflict');
Emitted when another worker already had the lock.
worker.on('release');
Emitted when the worker released his lock
worker.on('error');
inspiration
Most of the API design comes from twistedstream/singleton-process.