@apio/gravity-worker

1.1.0 • Public • Published

Apio Gravity Worker Helper

Helps you implement gravity job workers:

const {Worker} = require('/path/to/apio-gravity-worker/index.js')

const w = new Worker({
      topic: 'project.resource.action',
      scheduling: '* * * * *',
      gravityUrl: config.gravityBaseUrl
})

// React to a job
w.on('job', async job => {
  console.log("New job received",job)
})

// Starts the cron
w.start()

// Not waiting for the first cron tick running it right away
w.dequeue()

Dependents (0)

Package Sidebar

Install

npm i @apio/gravity-worker

Weekly Downloads

35

Version

1.1.0

License

ISC

Unpacked Size

8.5 kB

Total Files

8

Last publish

Collaborators

  • fatmatto
  • matteodisabatino