runsv-rinse-and-repeat
v0.0.1
Published
Do some work. Sleep. Repeat.
Readme
Rinse And Repeat
Do some work. Sleep. Repeat.
Install
$ npm i runsv-rinse-and-repeat
Usage
const MINUTE = 60 * 1000;
const runsv = require('runsv');
const createService = require('runsv-rinse-and-repeat');
async function work(params){
// Do your work
}
const myService = createService({
name: 'myService',
repeatEvery: 5 * MINUTE,
work
});
const sv = runsv.create();
sv.addService(myService);
// ...Params
The params object passed to the worker function has the following properties:
nameThe name of the service.repeatEveryMilliseconds to wait between runs. Min. value is 100 milliseconds.eventEmitterAn event emitter you can use.signalAbort signal you can use to stop your worker.dependenciesServices
