recurrent
v0.1.3
Published
redis-backed recurrent job manager
Downloads
8
Readme
recurrent
A redis-backed manager of recurrent jobs, for node.js.
(immature, with minimal testing and probably nasty bugs)
Features
- multiple queues, backed up by redis
- tasks have a permanent unique id and mutable associated data
- failed job runs are retried until they succeed or give up, with exponential back-off
- job retries and repetitions don't pile up
- the worker's job implementation determines at the end of each run when (and whether) to repeat
- as many worker processes as you want spread over multiple cores and machines - but you have to start them
Caveats
- single point of failure in queue manager (as well as redis itself) - you need to make sure it stays up / restarts quickly and there's exactly 1 instance
Installing
npm install recurrent
Running the manager
Make sure redis is running and then:
recurrent
offers a (currently very incomplete) web UI:
And then browse to localhost:7654
When the manager is not needed anymore:
Starting a recurrent job
Adding again the same taskId
will reset execution time.
When the client is not needed any more:
Recurrent job workers
When the job worker is not needed any more:
Task failure
Workers must not throw.
To signal failure a worker calls back with error. It can specify a retry time:
Or let recurrent
do exponential back-off
Exponential back-off can be configured per worker:
When a task is being retried after failure task.retries
contains how many retries have been attempted (including the current one).
It will undefined
for the first execution, 1
for the first retry and so on.