stop-agenda

0.0.6 • Public • Published

stop-agenda

build status code coverage code style styled with prettier made with lass license

Gracefully stop Agenda and cancel recurring jobs

Table of Contents

Install

npm:

npm install stop-agenda

yarn:

yarn add stop-agenda

Usage

You should probably be using Lad's agenda directly instead of this package.

With default options:

const stopAgenda = require('stop-agenda');
const Agenda = require('agenda');
 
const agenda = new Agenda();
 
stopAgenda(agenda).then().catch(console.error);

With advanced options including custom cancel query cancelQuery and check interval in milliseconds checkIntervalMs:

const stopAgenda = require('stop-agenda');
const Agenda = require('agenda');
 
const agenda = new Agenda();
 
stopAgenda(agenda, {
  cancelQuery: {
    repeatInterval: {
      $exists: true,
      $ne: null
    }
  },
  checkIntervalMs: 300
}).then().catch(console.error);

Options

stopAgenda accepts two arguments (agenda, config) and returns a Promise:

  • agenda (required) - a valid instance of Agenda

  • config (optional) - a configuration object which defaults to:

    {
      cancelQuery: {
        repeatInterval: {
          $exists: true,
          $ne: null
        }
      },
      // (uses `process.env.STOP_AGENDA_CHECK_INTERVAL` if set)
      checkIntervalMs: 500
    }

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.6
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.6
    3
  • 0.0.5
    1

Package Sidebar

Install

npm i stop-agenda

Weekly Downloads

4

Version

0.0.6

License

MIT

Last publish

Collaborators

  • niftylettuce
  • titanism