jobrun

1.0.3 • Public • Published

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)

Readme

Keywords

Package Sidebar

Install

npm i jobrun

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • moondef