mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
fix(core): Align saving behavior in workflowExecuteAfter
hooks (#12731)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
This commit is contained in:
parent
202da76380
commit
9d76210a57
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue