提交 b92517de 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

show feed detail on watchdog reset

上级 bf2bbb92
......@@ -40,30 +40,28 @@ function onFeed({
throw new Error('onFeed() must has `this` of instanceof PuppetWeb')
}
// process.nextTick(_ => {
log.verbose('PuppetWebWatchdog', 'onFeed: %s, %d, [%s]', type, timeout, data)
const feed = `${type}:[${data}]`
log.verbose('PuppetWebWatchdog', 'onFeed: %d, %s', timeout, feed)
switch (type) {
case 'POISON':
clearWatchDogTimer.call(this)
return
setWatchDogTimer.call(this, timeout, feed)
case 'SCAN':
case 'HEARTBEAT':
break
this.emit('heartbeat', feed)
default:
throw new Error('Watchdog onFeed: unsupport type ' + type)
}
monitorScan.call(this, type)
autoSaveSession.call(this)
setWatchDogTimer.call(this, timeout, (type + ':' + data))
switch (type) {
case 'POISON':
clearWatchDogTimer.call(this)
break
this.emit('heartbeat', type + ':' + data)
monitorScan.call(this, type)
autoSaveSession.call(this)
// }) // end nextTick
case 'SCAN':
case 'HEARTBEAT':
break
default:
throw new Error('Watchdog onFeed: unsupport type ' + type)
}
}
function clearWatchDogTimer() {
......@@ -82,9 +80,9 @@ function setWatchDogTimer(timeout, feed) {
clearWatchDogTimer.call(this)
log.silly('PuppetWebWatchdog', 'setWatchDogTimer(%d)', timeout)
log.silly('PuppetWebWatchdog', 'setWatchDogTimer(%d, %s)', timeout, feed)
this.watchDogTimer = setTimeout(watchDogReset.bind(this, timeout), timeout)
this.watchDogTimer = setTimeout(watchDogReset.bind(this, timeout, feed), timeout)
this.watchDogTimerTime = Date.now() + timeout
// block quit, force to use quit() // this.watchDogTimer.unref() // dont block quit
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册