define all server intervals in a map so we can easily clear them all

This commit is contained in:
ansuz
2020-02-03 17:14:23 -05:00
parent 3601bd6429
commit 43307ffb1a
4 changed files with 20 additions and 12 deletions

View File

@@ -13,6 +13,7 @@ module.exports.create = function (config) {
config.store = _store;
}));
}).nThen(function (w) {
// XXX embed this in historyKeeper
require("../storage/tasks").create(config, w(function (e, tasks) {
if (e) {
throw e;
@@ -20,8 +21,8 @@ module.exports.create = function (config) {
config.tasks = tasks;
if (config.disableIntegratedTasks) { return; }
// XXX support stopping this interval
setInterval(function () {
config.intervals = config.intervals || {};
config.intervals.taskExpiration = setInterval(function () {
tasks.runAll(function (err) {
if (err) {
// either TASK_CONCURRENCY or an error with tasks.list