Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Promise rewrite (#557)
Rewrite Agenda API support promises. This is a breaking change. No more callbacks! Instead of: ``` function graceful() { agenda.stop(function() { process.exit(0); }); } ``` You need to: ``` async function graceful() { await agenda.stop(); process.exit(0); } ``` You don't anymore have to listen for `start` event. Instead you can do: ``` await agenda.start(); agenda.every('10 minutes', 'example'); ``` However, this will still work: ``` agenda.on('ready', function () { agenda.every('10 minutes', 'example'); agenda.start(); }); ``` See the documentation for more! Drops support for Node.js versions 4, 5, 6 Contains also other small fixes: - Jobs _emit_ errors instead of throwing them - Fixes some flaky tests - Adds docs generator (`npm run docs` to generate `/docs`)
- Loading branch information
Showing
with
1,329 additions
and 1,229 deletions.
- +3 −1 .gitignore
- +23 −0 .jsdoc.json
- +49 −45 README.md
- +12 −14 lib/agenda/cancel.js
- +3 −2 lib/agenda/create.js
- +2 −0 lib/agenda/database.js
- +17 −13 lib/agenda/db-init.js
- +2 −0 lib/agenda/default-concurrency.js
- +3 −1 lib/agenda/default-lock-lifetime.js
- +3 −1 lib/agenda/default-lock-limit.js
- +2 −0 lib/agenda/define.js
- +31 −48 lib/agenda/every.js
- +7 −5 lib/agenda/find-and-lock-next-job.js
- +26 −8 lib/agenda/index.js
- +8 −14 lib/agenda/jobs.js
- +3 −1 lib/agenda/locklimit.js
- +2 −0 lib/agenda/max-concurrency.js
- +2 −0 lib/agenda/mongo.js
- +2 −0 lib/agenda/name.js
- +9 −7 lib/agenda/now.js
- +2 −0 lib/agenda/process-every.js
- +7 −6 lib/agenda/purge.js
- +115 −122 lib/agenda/save-job.js
- +24 −42 lib/agenda/schedule.js
- +2 −0 lib/agenda/sort.js
- +10 −6 lib/agenda/start.js
- +22 −21 lib/agenda/stop.js
- +2 −0 lib/job/compute-next-run-at.js
- +2 −0 lib/job/disable.js
- +3 −1 lib/job/enable.js
- +2 −0 lib/job/fail.js
- +6 −0 lib/job/index.js
- +3 −1 lib/job/is-running.js
- +2 −0 lib/job/priority.js
- +5 −4 lib/job/remove.js
- +2 −0 lib/job/repeat-at.js
- +4 −2 lib/job/repeat-every.js
- +55 −50 lib/job/run.js
- +7 −5 lib/job/save.js
- +2 −0 lib/job/schedule.js
- +2 −0 lib/job/to-json.js
- +2 −0 lib/job/touch.js
- +2 −0 lib/job/unique.js
- +14 −0 lib/no-callback.js
- +1 −1 lib/utils/create-job.js
- +6 −4 lib/utils/process-jobs.js
- +9 −1 package.json
- +190 −273 test/agenda.js
- +2 −2 test/fixtures/agenda-instance.js
- +428 −501 test/job.js
- +23 −24 test/retry.js
- +164 −3 yarn.lock
@@ -1,3 +1,5 @@ | ||
node_modules | ||
coverage.html | ||
.idea | ||
.idea | ||
.DS_Store | ||
docs |
@@ -0,0 +1,23 @@ | ||
{ | ||
"tags": { | ||
"allowUnknownTags": true, | ||
"dictionaries": ["jsdoc"] | ||
}, | ||
"source": { | ||
"include": ["lib", "package.json", "README.md"], | ||
"includePattern": ".js$", | ||
"excludePattern": "(node_modules/|docs)" | ||
}, | ||
"plugins": [ | ||
"plugins/markdown" | ||
], | ||
"templates": { | ||
"referenceTitle": "Agenda" | ||
}, | ||
"opts": { | ||
"destination": "./docs/", | ||
"encoding": "utf8", | ||
"recurse": true, | ||
"template": "./node_modules/jsdoc-template" | ||
} | ||
} |
Oops, something went wrong.