1.0.3 • Published 5 years ago

jobrun v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Jobrun

Simple job runner for MongoDB

Usage

$ npm install --save jobrun

or

$ yarn add jobrun

Example of usage

const dbLink = 'mongodb://localhost:27017/jobrunner'; 

const myJb = new JobRun(dbLink);

const DELETE_UNACTIVE_USERS = 'delete unactive users';

myJb.createJob(DELETE_UNACTIVE_USERS, () => {
  User.remove({lastLogIn: {$lt: yourDate}});
});

(async () => {
  await myJb.start();
  await myJb.every(3000, DELETE_UNACTIVE_USERS);
})();

Documentation

  • createJob(url, cb)
  • start()
  • every(timeout, url)
  • stop(url)
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago