diff --git a/config/default.js b/config/default.js index 7e82b22..010c977 100644 --- a/config/default.js +++ b/config/default.js @@ -30,8 +30,9 @@ var config = { // Notification action period -- clients are given a randomly chosen delay within this time // period before they should act upon the notification, so that we don't DDoS ourselves globalTopicsDelayPeriod: 1800 * 1000, - continuedDelayDefault: 3 * 1000, + defaultDelay: 3 * 1000, continuedDelay: 30 * 1000, + notContinuedDelay: 250, statsD: { host: '' } diff --git a/config/test.json b/config/test.json index 63ea8e3..90105fc 100644 --- a/config/test.json +++ b/config/test.json @@ -4,5 +4,5 @@ "redis": { "prefix": "" }, - "continuedDelayDefault": 0 + "defaultDelay": 0 } diff --git a/server.js b/server.js index 70f772e..c7a4e93 100644 --- a/server.js +++ b/server.js @@ -60,10 +60,15 @@ module.exports = function (onInit) { clearTimeout(timeout); delete continuedTimeouts[topic]; } - - continuedTimeouts[topic] = setTimeout(fn, - continued ? config.get('continuedDelay') : config.get('continuedDelayDefault') - ); + if (continued) { + continuedTimeouts[topic] = setTimeout(fn, config.get('continuedDelay')); + } + else if (continued == false) { + continuedTimeouts[topic] = setTimeout(fn, config.get('notContinuedDelay')); + } + else { + continuedTimeouts[topic] = setTimeout(fn, config.get('defaultDelay')); + } } /**