Short-circuit heartbeat when alive
This commit is contained in:
parent
504d89638b
commit
f2f1fee6f1
|
@ -21,7 +21,10 @@ export class Heart {
|
||||||
* activity. Failures are logged as warnings.
|
* activity. Failures are logged as warnings.
|
||||||
*/
|
*/
|
||||||
public beat(): void {
|
public beat(): void {
|
||||||
if (!this.alive()) {
|
if (this.alive()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
logger.trace("heartbeat")
|
logger.trace("heartbeat")
|
||||||
fs.writeFile(this.heartbeatPath, "").catch((error) => {
|
fs.writeFile(this.heartbeatPath, "").catch((error) => {
|
||||||
logger.warn(error.message)
|
logger.warn(error.message)
|
||||||
|
@ -42,5 +45,4 @@ export class Heart {
|
||||||
})
|
})
|
||||||
}, this.heartbeatInterval)
|
}, this.heartbeatInterval)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue