mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
fix(core): Deleting manual executions should defer deleting binary data (#6680)
deleting manual executions should defer deleting binary data
This commit is contained in:
parent
b69d20c12e
commit
462a674d17
|
@ -578,7 +578,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
|||
|
||||
if (isManualMode && !saveManualExecutions && !fullRunData.waitTill) {
|
||||
// Data is always saved, so we remove from database
|
||||
await Container.get(ExecutionRepository).deleteExecution(this.executionId);
|
||||
await Container.get(ExecutionRepository).deleteExecution(this.executionId, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -66,11 +66,11 @@ function parseFiltersToQueryBuilder(
|
|||
|
||||
@Service()
|
||||
export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
private executionDataRepository: ExecutionDataRepository;
|
||||
|
||||
constructor(dataSource: DataSource, executionDataRepository: ExecutionDataRepository) {
|
||||
constructor(
|
||||
dataSource: DataSource,
|
||||
private readonly executionDataRepository: ExecutionDataRepository,
|
||||
) {
|
||||
super(ExecutionEntity, dataSource.manager);
|
||||
this.executionDataRepository = executionDataRepository;
|
||||
}
|
||||
|
||||
async findMultipleExecutions(
|
||||
|
@ -238,9 +238,13 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
|||
}
|
||||
}
|
||||
|
||||
async deleteExecution(executionId: string) {
|
||||
// TODO: Should this be awaited? Should we add a catch in case it fails?
|
||||
await BinaryDataManager.getInstance().deleteBinaryDataByExecutionIds([executionId]);
|
||||
async deleteExecution(executionId: string, deferBinaryDataDeletion = false) {
|
||||
const binaryDataManager = BinaryDataManager.getInstance();
|
||||
if (deferBinaryDataDeletion) {
|
||||
await binaryDataManager.markDataForDeletionByExecutionId(executionId);
|
||||
} else {
|
||||
await binaryDataManager.deleteBinaryDataByExecutionIds([executionId]);
|
||||
}
|
||||
return this.delete({ id: executionId });
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue