refactor(core): Add an option to use simple recovery process by default (#7097)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-09-04 19:58:36 +02:00
committed by GitHub
parent ee36f2d20b
commit cffda65b33
3 changed files with 22 additions and 9 deletions

View File

@@ -126,18 +126,15 @@ export class MessageEventBus extends EventEmitter {
LoggerProxy.info(` - ${workflowData.name} (ID: ${workflowData.id})`);
}
}
if (this.logWriter?.isRecoveryProcessRunning()) {
const recoveryAlreadyAttempted = this.logWriter?.isRecoveryProcessRunning();
if (recoveryAlreadyAttempted || config.getEnv('eventBus.crashRecoveryMode') === 'simple') {
await Container.get(ExecutionRepository).markAsCrashed(unfinishedExecutionIds);
// if we end up here, it means that the previous recovery process did not finish
// a possible reason would be that recreating the workflow data itself caused e.g an OOM error
// in that case, we do not want to retry the recovery process, but rather mark the executions as crashed
LoggerProxy.warn('Skipping recover process since it previously failed.');
for (const executionId of unfinishedExecutionIds) {
LoggerProxy.info(`Setting status of execution ${executionId} to crashed`);
await Container.get(ExecutionRepository).updateExistingExecution(executionId, {
status: 'crashed',
stoppedAt: new Date(),
});
}
if (recoveryAlreadyAttempted)
LoggerProxy.warn('Skipped recovery process since it previously failed.');
} else {
// start actual recovery process and write recovery process flag file
this.logWriter?.startRecoveryProcess();