From c4a98c0df71eed288b1f46bf2c098273f71de04d Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 29 Jan 2013 00:53:37 +0000 Subject: [PATCH] fix #249 --- modules/timers/timers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/timers/timers.js b/modules/timers/timers.js index 073114f..b1e968d 100644 --- a/modules/timers/timers.js +++ b/modules/timers/timers.js @@ -15,7 +15,7 @@ var timers = function(dbot) { if(firstDate) { console.log('Setting first timer to run at ' + firstDate); firstTimeout = firstDate.getTime() - now; - setTimeout(function() { + this.runningTimeouts.push(setTimeout(function() { console.log('Running first timer at ' + new Date().toUTCString()); this.runningIntervals.push(this.api.addTimer(timeout, callback)); try { @@ -23,7 +23,7 @@ var timers = function(dbot) { } catch(err) { console.log('Callback failed: ' + err); } - }.bind(this), firstTimeout); + }.bind(this), firstTimeout)); } else { this.runningIntervals.push(setInterval(function() { console.log('Running subsequent timer at ' + new Date().toUTCString()); @@ -39,9 +39,11 @@ var timers = function(dbot) { this.onDestroy = function() { for(var i=0;i