mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Skip canceled executions in unfinished execution recovery (#19452)
Co-authored-by: Danny Martini <danny@n8n.io>
This commit is contained in:
@@ -175,6 +175,31 @@ describe('ExecutionRecoveryService', () => {
|
|||||||
expect(amendedExecution).toBeNull();
|
expect(amendedExecution).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('for canceled executions with data, should return `null`', async () => {
|
||||||
|
/**
|
||||||
|
* Arrange
|
||||||
|
*/
|
||||||
|
const workflow = await createWorkflow();
|
||||||
|
const execution = await createExecution(
|
||||||
|
{ status: 'canceled', data: stringify({ runData: {} }) },
|
||||||
|
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 () => {
|
test('should return `null` if no execution found', async () => {
|
||||||
/**
|
/**
|
||||||
* Arrange
|
* Arrange
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ export class ExecutionRecoveryService {
|
|||||||
* because execution lifecycle hooks cause worker event logs to be partitioned.
|
* because execution lifecycle hooks cause worker event logs to be partitioned.
|
||||||
* Hence we need to filter out finished executions here.
|
* Hence we need to filter out finished executions here.
|
||||||
* */
|
* */
|
||||||
if (!execution || (['success', 'error'].includes(execution.status) && execution.data)) {
|
if (
|
||||||
|
!execution ||
|
||||||
|
(['success', 'error', 'canceled'].includes(execution.status) && execution.data)
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user