JSPM

@kev_nz/delayed-job

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1328
  • Score
    100M100P100Q119271F
  • License MIT

Redis backed Node.js implementation of delayed job

Package Exports

  • @kev_nz/delayed-job

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kev_nz/delayed-job) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

delayed-job

delayed-job is a horizontally scalable Node.js implementation of Ruby's delayed_job. Using semaphore locks it aims to provide an atomic interface to a federation of workers operating on the same job queue. Initial work has focussed on a Redis backed database, however more backend implementations are possible.

delayed-job

Installation

npm install @kev_nz/delayed-job

Usage

const Scheduler = require('@kev_nz/delayed-job')

const schedule = Scheduler.createSchedule({
  url: '',
  backend: {
    name: 'redis', // memory is also available
    jobHoldingBay: 'myUniqueListKey'
  }
})

schedule.on('job', job => {
  console.log('Received job',job);
})

const myJob = {
  title: 'Great Gig In The Sky'
}

schedule.delay(myJob, 2000)

API

schedular.delay(job, timeout)

Schedule a job for execution

Assumptions

  • errors thrown will result in re-establishing the scheduler [expand]
  • Single atomic source of truth
  • Db interactions are also atomic
  • Jobs emitted have no immediate relationship to one another

Prior Art

Originally based on https://github.com/thatguydan/delayed-job But that project hasn't been update in six years