refactor: Delete dead crash recovery code (no-changelog) (#9512)
This commit is contained in:
@@ -13,11 +13,7 @@ import { WorkflowRepository } from '@db/repositories/workflow.repository';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { Logger } from '@/Logger';
|
||||
|
||||
import type {
|
||||
EventMessageTypes,
|
||||
EventNamesTypes,
|
||||
FailedEventSummary,
|
||||
} from '../EventMessageClasses/';
|
||||
import type { EventMessageTypes } from '../EventMessageClasses/';
|
||||
import type { MessageEventBusDestination } from '../MessageEventBusDestination/MessageEventBusDestination.ee';
|
||||
import { MessageEventBusLogWriter } from '../MessageEventBusWriter/MessageEventBusLogWriter';
|
||||
import { messageEventBusDestinationFromDb } from '../MessageEventBusDestination/MessageEventBusDestinationFromDb';
|
||||
@@ -361,48 +357,6 @@ export class MessageEventBus extends EventEmitter {
|
||||
);
|
||||
}
|
||||
|
||||
async getEventsFailed(amount = 5): Promise<FailedEventSummary[]> {
|
||||
const result: FailedEventSummary[] = [];
|
||||
try {
|
||||
const queryResult = await this.logWriter?.getMessagesAll();
|
||||
const uniques = uniqby(queryResult, 'id');
|
||||
const filteredExecutionIds = uniques
|
||||
.filter((e) =>
|
||||
(['n8n.workflow.crashed', 'n8n.workflow.failed'] as EventNamesTypes[]).includes(
|
||||
e.eventName,
|
||||
),
|
||||
)
|
||||
.map((e) => ({
|
||||
executionId: e.payload.executionId as string,
|
||||
name: e.payload.workflowName,
|
||||
timestamp: e.ts,
|
||||
event: e.eventName,
|
||||
}))
|
||||
.filter((e) => e)
|
||||
.sort((a, b) => (a.timestamp > b.timestamp ? 1 : -1))
|
||||
.slice(-amount);
|
||||
|
||||
for (const execution of filteredExecutionIds) {
|
||||
const data = await this.recoveryService.recoverExecutionData(
|
||||
execution.executionId,
|
||||
queryResult,
|
||||
false,
|
||||
);
|
||||
if (data) {
|
||||
const lastNodeExecuted = data.resultData.lastNodeExecuted;
|
||||
result.push({
|
||||
lastNodeExecuted: lastNodeExecuted ?? '',
|
||||
executionId: execution.executionId,
|
||||
name: execution.name as string,
|
||||
event: execution.event,
|
||||
timestamp: execution.timestamp.toISO(),
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
return result;
|
||||
}
|
||||
|
||||
async getEventsAll(): Promise<EventMessageTypes[]> {
|
||||
const queryResult = await this.logWriter?.getMessagesAll();
|
||||
const filtered = uniqby(queryResult, 'id');
|
||||
|
||||
Reference in New Issue
Block a user