Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ladjs/agenda
Agenda for Lad
https://github.com/ladjs/agenda
agenda api auto-reconnect autoreconnect cron cronjob crontab graceful handler jobs koa lad mongoose reconnect reconnection reload scheduling
Last synced: 8 days ago
JSON representation
Agenda for Lad
- Host: GitHub
- URL: https://github.com/ladjs/agenda
- Owner: ladjs
- License: mit
- Created: 2017-12-01T21:20:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T02:37:46.000Z (2 months ago)
- Last Synced: 2024-10-29T19:59:46.233Z (18 days ago)
- Topics: agenda, api, auto-reconnect, autoreconnect, cron, cronjob, crontab, graceful, handler, jobs, koa, lad, mongoose, reconnect, reconnection, reload, scheduling
- Language: JavaScript
- Homepage: https://lad.js.org
- Size: 181 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [**@ladjs/agenda**](https://github.com/ladjs/agenda)
[![build status](https://img.shields.io/travis/ladjs/agenda.svg)](https://travis-ci.org/ladjs/agenda)
[![code coverage](https://img.shields.io/codecov/c/github/ladjs/agenda.svg)](https://codecov.io/gh/ladjs/agenda)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/ladjs/agenda.svg)](LICENSE)> Agenda for Lad
Agenda is:
> A light-weight job scheduling library for Node.js## Table of Contents
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)## Install
[npm][]:
```sh
npm install @ladjs/agenda
```[yarn][]:
```sh
yarn add @ladjs/agenda
```## Usage
This package serves as a drop-in replacement for a normal [Agenda](https://www.npmjs.com/package/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:
```js
#!/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`
//
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** | |## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/
[stop-agenda]: https://github.com/ladjs/stop-agenda