forked from GitHub/dbot
callback fix for [#233]
This commit is contained in:
parent
bd32a06276
commit
bd75519047
@ -15,13 +15,13 @@ var timers = function(dbot) {
|
|||||||
if(firstDate) {
|
if(firstDate) {
|
||||||
console.log('Setting first timer to run at ' + firstDate);
|
console.log('Setting first timer to run at ' + firstDate);
|
||||||
firstTimeout = firstDate.getTime() - now;
|
firstTimeout = firstDate.getTime() - now;
|
||||||
setTimeout(function(callback) {
|
setTimeout(function() {
|
||||||
console.log('Running first timer at ' + new Date().toUTCString());
|
console.log('Running first timer at ' + new Date().toUTCString());
|
||||||
this.runningIntervals.push(this.api.addTimer(timeout, callback));
|
this.runningIntervals.push(this.api.addTimer(timeout, callback));
|
||||||
callback();
|
callback();
|
||||||
}.bind(this), firstTimeout);
|
}.bind(this), firstTimeout);
|
||||||
} else {
|
} else {
|
||||||
this.runningIntervals.push(setInterval(function(callback) {
|
this.runningIntervals.push(setInterval(function() {
|
||||||
console.log('Running subsequent timer at ' + new Date().toUTCString());
|
console.log('Running subsequent timer at ' + new Date().toUTCString());
|
||||||
callback();
|
callback();
|
||||||
}.bind(this), timeout));
|
}.bind(this), timeout));
|
||||||
|
Loading…
Reference in New Issue
Block a user