@ladjs/agenda

Agenda for Lad

Stats

StarsIssuesVersionUpdatedCreatedSize
@ladjs/agenda
100.0.53 years ago4 years agoMinified + gzip package size for @ladjs/agenda in KB

Readme

@ladjs/agenda

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

Agenda for Lad

Table of Contents

Install

npm:

npm install @ladjs/agenda

yarn:

yarn add @ladjs/agenda

Usage

This package serves as a drop-in replacement for a normal Agenda require() call. It carries the same exact API and returns the same Agenda instance that it normally would (except it adds some extra glue on top, such as built-in integration of stop-agenda).

Default options are shown below:

#!/usr/bin/env node
const Agenda = require('@ladjs/agenda');
const mongoose = require('@ladjs/mongoose');
const Graceful = require('@ladjs/graceful');

const agenda = new Agenda();
agenda.configure({
  logger: console,
  // these are options passed directly to `stop-agenda`
  // <https://github.com/ladjs/stop-agenda>
  stopAgenda: {
    cancelQuery: {
      repeatInterval: {
        $exists: true,
        $ne: null
      }
    }
  },
  // these are jobs defined via `config.jobs`
  // e.g. `agendaJobDefinitions: [ [name, agendaOptions, fn], ... ]`
  agendaJobDefinitions: [],
  // these get automatically invoked to `agenda.every`
  // e.g. `agenda.every('5 minutes', 'locales')`
  // and you define them as [ interval, job name ]
  // you need to define them here for graceful handling
  // e.g. `agendaRecurringJobs: [ ['5 minutes', 'locales' ], ... ]`
  agendaRecurringJobs: [],
  // these get automatically invoked when process starts
  // e.g. `agenda.now('locales');`
  // and you define them as Strings in the array
  // e.g. `config.now: ['locales','ping','pong','beep', ... ]`
  agendaBootJobs: []
});

mongoose.configure({
  ...config.mongoose,
  logger,
  agenda
});

mongoose
  .connect()
  .then(() => {
    agenda.start();
  })
  .catch(logger.error);

const graceful = new Graceful({
  mongoose,
  agenda,
  logger
});

graceful.listen();

Contributors

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

License

MIT © Nick Baugh

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.