fix(core): Fix ignoring crashed executions without event msgs (#7368)
when the event logs do not contain messages for running executions, the recovery/crash detection on startup would skip these. this PR fixes that.
This commit is contained in:
committed by
GitHub
parent
c77042f2bb
commit
2f4d91b2cd
@@ -24,6 +24,8 @@ import type { MessageEventBusDestinationWebhook } from '@/eventbus/MessageEventB
|
||||
import type { MessageEventBusDestinationSentry } from '@/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee';
|
||||
import { EventMessageAudit } from '@/eventbus/EventMessageClasses/EventMessageAudit';
|
||||
import type { EventNamesTypes } from '@/eventbus/EventMessageClasses';
|
||||
import { EventMessageWorkflow } from '@/eventbus/EventMessageClasses/EventMessageWorkflow';
|
||||
import { EventMessageNode } from '@/eventbus/EventMessageClasses/EventMessageNode';
|
||||
|
||||
jest.unmock('@/eventbus/MessageEventBus/MessageEventBus');
|
||||
jest.mock('axios');
|
||||
@@ -389,3 +391,57 @@ test('DELETE /eventbus/destination delete all destinations by id', async () => {
|
||||
|
||||
expect(Object.keys(eventBus.destinations).length).toBe(0);
|
||||
});
|
||||
|
||||
// These two tests are running very flaky on CI due to the logwriter working in a worker
|
||||
// Mocking everything on the other would defeat the purpose of even testing them... so, skipping in CI for now.
|
||||
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||
test.skip('should not find unfinished executions in recovery process', async () => {
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageWorkflow({
|
||||
eventName: 'n8n.workflow.started',
|
||||
payload: { executionId: '509', isManual: false },
|
||||
}),
|
||||
);
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageNode({
|
||||
eventName: 'n8n.node.started',
|
||||
payload: { executionId: '509', nodeName: 'Set', workflowName: 'test' },
|
||||
}),
|
||||
);
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageNode({
|
||||
eventName: 'n8n.node.finished',
|
||||
payload: { executionId: '509', nodeName: 'Set', workflowName: 'test' },
|
||||
}),
|
||||
);
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageWorkflow({
|
||||
eventName: 'n8n.workflow.success',
|
||||
payload: { executionId: '509', success: true },
|
||||
}),
|
||||
);
|
||||
const unfinishedExecutions = await eventBus.getUnfinishedExecutions();
|
||||
|
||||
expect(Object.keys(unfinishedExecutions)).toHaveLength(0);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||
test.skip('should not find unfinished executions in recovery process', async () => {
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageWorkflow({
|
||||
eventName: 'n8n.workflow.started',
|
||||
payload: { executionId: '510', isManual: false },
|
||||
}),
|
||||
);
|
||||
eventBus.logWriter?.putMessage(
|
||||
new EventMessageNode({
|
||||
eventName: 'n8n.node.started',
|
||||
payload: { executionId: '510', nodeName: 'Set', workflowName: 'test' },
|
||||
}),
|
||||
);
|
||||
|
||||
const unfinishedExecutions = await eventBus.getUnfinishedExecutions();
|
||||
|
||||
expect(Object.keys(unfinishedExecutions)).toHaveLength(1);
|
||||
expect(Object.keys(unfinishedExecutions)).toContain('510');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user