mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
fix(core): Align saving behavior in workflowExecuteAfter hooks (#12731)
This commit is contained in:
@@ -500,6 +500,10 @@ describe('Execution Lifecycle Hooks', () => {
|
|||||||
saveDataSuccessExecution: 'none',
|
saveDataSuccessExecution: 'none',
|
||||||
saveDataErrorExecution: 'all',
|
saveDataErrorExecution: 'all',
|
||||||
};
|
};
|
||||||
|
const hooks = getWorkflowHooksWorkerMain('webhook', executionId, workflowData, {
|
||||||
|
pushRef,
|
||||||
|
retryOf,
|
||||||
|
});
|
||||||
|
|
||||||
await hooks.executeHookFunctions('workflowExecuteAfter', [successfulRun, {}]);
|
await hooks.executeHookFunctions('workflowExecuteAfter', [successfulRun, {}]);
|
||||||
|
|
||||||
@@ -514,6 +518,10 @@ describe('Execution Lifecycle Hooks', () => {
|
|||||||
saveDataSuccessExecution: 'all',
|
saveDataSuccessExecution: 'all',
|
||||||
saveDataErrorExecution: 'none',
|
saveDataErrorExecution: 'none',
|
||||||
};
|
};
|
||||||
|
const hooks = getWorkflowHooksWorkerMain('webhook', executionId, workflowData, {
|
||||||
|
pushRef,
|
||||||
|
retryOf,
|
||||||
|
});
|
||||||
|
|
||||||
await hooks.executeHookFunctions('workflowExecuteAfter', [failedRun, {}]);
|
await hooks.executeHookFunctions('workflowExecuteAfter', [failedRun, {}]);
|
||||||
|
|
||||||
|
|||||||
@@ -1150,11 +1150,28 @@ export function getWorkflowHooksWorkerMain(
|
|||||||
|
|
||||||
const saveSettings = toSaveSettings(this.workflowData.settings);
|
const saveSettings = toSaveSettings(this.workflowData.settings);
|
||||||
|
|
||||||
|
const isManualMode = this.mode === 'manual';
|
||||||
|
|
||||||
|
if (isManualMode && !saveSettings.manual && !fullRunData.waitTill) {
|
||||||
|
/**
|
||||||
|
* When manual executions are not being saved, we only soft-delete
|
||||||
|
* the execution so that the user can access its binary data
|
||||||
|
* while building their workflow.
|
||||||
|
*
|
||||||
|
* The manual execution and its binary data will be hard-deleted
|
||||||
|
* on the next pruning cycle after the grace period set by
|
||||||
|
* `EXECUTIONS_DATA_HARD_DELETE_BUFFER`.
|
||||||
|
*/
|
||||||
|
await Container.get(ExecutionRepository).softDelete(this.executionId);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const shouldNotSave =
|
const shouldNotSave =
|
||||||
(executionStatus === 'success' && !saveSettings.success) ||
|
(executionStatus === 'success' && !saveSettings.success) ||
|
||||||
(executionStatus !== 'success' && !saveSettings.error);
|
(executionStatus !== 'success' && !saveSettings.error);
|
||||||
|
|
||||||
if (shouldNotSave) {
|
if (!isManualMode && shouldNotSave && !fullRunData.waitTill) {
|
||||||
await Container.get(ExecutionRepository).hardDelete({
|
await Container.get(ExecutionRepository).hardDelete({
|
||||||
workflowId: this.workflowData.id,
|
workflowId: this.workflowData.id,
|
||||||
executionId: this.executionId,
|
executionId: this.executionId,
|
||||||
|
|||||||
Reference in New Issue
Block a user