Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

cantina-cron

4.1.3 • Public • Published

cantina-cron

An amino/redis-powered in-app crontab.

Dependencies

Provides

  • app.cron - The Cron API

Configuration

Though you can manually schedule jobs via the api, the more common way to setup your's app's jobs is through your configuration.

{
  "cron": {
    "active": true
    "jobs": [
      {
        title: 'News Aggregator'
        cronTime: '* * * * *'
        queue: 'aggregator:queue'
        payload: {}
      },
      {
        title: 'Check Approaching Resource Expiration'
        cronTime: '0 0 * * *'
        queue: 'resource:expiration:check'
        payload: {}
      }
    ]
  }
}

Usage

If app.conf.get('cron:active') === true then your cron jobs will start being polled as soon as app.start() is called. The queue values of jobs should map to queue workers in your app.

API

app.cron.schedule (job)

Schedule a job. See the config example above for job format.

app.cron.start

Start the cron interval.

app.cron.stop

Stop the cron interval.

app.cron.poll

Manually trigger a poll through the cron jobs.


Developed by TerraEclipse

Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.

Keywords

install

npm i cantina-cron

Downloadsweekly downloads

8

version

4.1.3

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability