From f44a44ccb988211834e9cc083f028a54174ebb90 Mon Sep 17 00:00:00 2001 From: Zhuohuan LI Date: Fri, 15 Jul 2016 12:03:14 +0800 Subject: [PATCH] log time before timeout when clear a timer --- src/puppet-web/watchdog.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/puppet-web/watchdog.js b/src/puppet-web/watchdog.js index 32ead343..f1fb6e8e 100644 --- a/src/puppet-web/watchdog.js +++ b/src/puppet-web/watchdog.js @@ -66,7 +66,9 @@ function clearWatchDogTimer() { if (this.watchDogTimer) { clearTimeout(this.watchDogTimer) this.watchDogTimer = null - log.silly('PuppetWebWatchdog', 'clearWatchDogTimer() cleared') + + const timeLeft = this.watchDogTimerTime - Date.now() + log.silly('PuppetWebWatchdog', 'clearWatchDogTimer() cleared, before %d seconds left', Math.ceil(timeLeft / 1000)) } else { log.silly('PuppetWebWatchdog', 'clearWatchDogTimer() nothing to clear') } @@ -79,6 +81,7 @@ function setWatchDogTimer(timeout) { log.silly('PuppetWebWatchdog', 'setWatchDogTimer(%d)', timeout) this.watchDogTimer = setTimeout(watchDogReset.bind(this, timeout), timeout) + this.watchDogTimerTime = Date.now() + timeout // block quit, force to use quit() // this.watchDogTimer.unref() // dont block quit } -- GitLab