Skip to content
Snippets Groups Projects
Unverified Commit 5c3b6b90 authored by Douglas Gubert's avatar Douglas Gubert Committed by GitHub
Browse files

chore: add reason to app restart log (#33930)

parent fd7eb762
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,7 @@ export class LivenessManager {
if (reason === 'timeout' && this.pingTimeoutConsecutiveCount >= this.options.consecutiveTimeoutLimit) {
this.debug('Subprocess failed to respond to pings %d consecutive times. Attempting restart...', this.options.consecutiveTimeoutLimit);
this.restartProcess();
this.restartProcess('Too many pings timed out');
return false;
}
......@@ -164,17 +164,21 @@ export class LivenessManager {
return;
}
let reason: string;
// Otherwise we try to restart the subprocess, if possible
if (signal) {
this.debug('App has been killed (%s). Attempting restart #%d...', signal, this.restartCount + 1);
reason = `App has been killed with signal ${signal}`;
} else {
this.debug('App has exited with code %d. Attempting restart #%d...', exitCode, this.restartCount + 1);
reason = `App has exited with code ${exitCode}`;
}
this.restartProcess();
this.restartProcess(reason);
}
private restartProcess() {
private restartProcess(reason: string) {
if (this.restartCount >= this.options.maxRestarts) {
this.debug('Limit of restarts reached (%d). Aborting restart...', this.options.maxRestarts);
this.controller.stopApp();
......@@ -184,6 +188,7 @@ export class LivenessManager {
this.pingTimeoutConsecutiveCount = 0;
this.restartCount++;
this.restartLog.push({
reason,
restartedAt: new Date(),
source: 'liveness-manager',
pid: this.subprocess.pid,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment