runsv-rinse-and-repeat

0.0.1 • Public • Published

Rinse And Repeat

Do some work. Sleep. Repeat.

npm pipeline status coverage report

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:

  • name The name of the service.
  • repeatEvery Milliseconds to wait between runs. Min. value is 100 milliseconds.
  • eventEmitter An event emitter you can use.
  • signal Abort signal you can use to stop your worker.
  • dependencies Services

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i runsv-rinse-and-repeat

    Weekly Downloads

    39

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    12.5 kB

    Total Files

    12

    Last publish

    Collaborators

    • p.revington