fix(core): Handle max stalled count error better (#12824)

This commit is contained in:
Iván Ovejero
2025-01-27 13:44:20 +01:00
committed by GitHub
parent 648c6f9315
commit eabf160957
3 changed files with 17 additions and 9 deletions

View File

@@ -37,6 +37,8 @@ import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-da
import { generateFailedExecutionFromError } from '@/workflow-helpers';
import { WorkflowStaticDataService } from '@/workflows/workflow-static-data.service';
import { MaxStalledCountError } from './errors/max-stalled-count.error';
@Service()
export class WorkflowRunner {
private scalingService: ScalingService;
@@ -416,6 +418,13 @@ export class WorkflowRunner {
try {
await job.finished();
} catch (error) {
if (
error instanceof Error &&
error.message.includes('job stalled more than maxStalledCount')
) {
error = new MaxStalledCountError(error);
}
// We use "getWorkflowHooksWorkerExecuter" as "getWorkflowHooksWorkerMain" does not contain the
// "workflowExecuteAfter" which we require.
const hooks = getWorkflowHooksWorkerExecuter(
@@ -424,6 +433,7 @@ export class WorkflowRunner {
data.workflowData,
{ retryOf: data.retryOf ? data.retryOf.toString() : undefined },
);
await this.processError(error, new Date(), data.executionMode, executionId, hooks);
reject(error);