Skip to content

[3.x] In-app multi-process-safe cron for cantina applications.

License

Notifications You must be signed in to change notification settings

cantina/cantina-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

[3.x] In-app multi-process-safe cron for cantina applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published