Skip to content

Commit

Permalink
fix(core): Ensure execution recovery skips successful executions (n8n…
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Jun 19, 2024
1 parent e3e20b4 commit 4131408
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,28 @@ describe('ExecutionRecoveryService', () => {
});

describe('if leader, with 1+ messages', () => {
test('should return `null` if execution succeeded', async () => {
/**
* Arrange
*/
const workflow = await createWorkflow();
const execution = await createExecution({ status: 'success' }, workflow);
const messages = setupMessages(execution.id, 'Some workflow');

/**
* Act
*/
const amendedExecution = await executionRecoveryService.recoverFromLogs(
execution.id,
messages,
);

/**
* Assert
*/
expect(amendedExecution).toBeNull();
});

test('should return `null` if no execution found', async () => {
/**
* Arrange
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/executions/execution-recovery.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class ExecutionRecoveryService {
unflattenData: true,
});

if (!execution) return null;
if (!execution || execution.status === 'success') return null;

const runExecutionData = execution.data ?? { resultData: { runData: {} } };

Expand Down

0 comments on commit 4131408

Please sign in to comment.