mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Fix pruning of non-finished executions (#7333)
This fixes a bug in the pruning (soft-delete). The pruning was a bit too aggressive, as it also pruned executions that weren't in an end state yet. This only becomes an issue if there are long-running executions (e.g. workflow with Wait node) or the prune parameters are set to keep only a tiny number of executions.
This commit is contained in:
@@ -360,11 +360,11 @@ export async function createManyExecutions(
|
||||
/**
|
||||
* Store a execution in the DB and assign it to a workflow.
|
||||
*/
|
||||
async function createExecution(
|
||||
export async function createExecution(
|
||||
attributes: Partial<ExecutionEntity & ExecutionData>,
|
||||
workflow: WorkflowEntity,
|
||||
) {
|
||||
const { data, finished, mode, startedAt, stoppedAt, waitTill, status } = attributes;
|
||||
const { data, finished, mode, startedAt, stoppedAt, waitTill, status, deletedAt } = attributes;
|
||||
|
||||
const execution = await Db.collections.Execution.save({
|
||||
finished: finished ?? true,
|
||||
@@ -374,6 +374,7 @@ async function createExecution(
|
||||
stoppedAt: stoppedAt ?? new Date(),
|
||||
waitTill: waitTill ?? null,
|
||||
status,
|
||||
deletedAt,
|
||||
});
|
||||
|
||||
await Db.collections.ExecutionData.save({
|
||||
|
||||
Reference in New Issue
Block a user