mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Save exeution progress for waiting executions, even when progress saving is disabled (#11535)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
19a5c2fcf1
commit
6b9353c80f
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
deepCopy,
|
||||||
ErrorReporterProxy,
|
ErrorReporterProxy,
|
||||||
type IRunExecutionData,
|
type IRunExecutionData,
|
||||||
type ITaskData,
|
type ITaskData,
|
||||||
|
@ -57,7 +58,7 @@ test('should ignore on leftover async call', async () => {
|
||||||
expect(executionRepository.updateExistingExecution).not.toHaveBeenCalled();
|
expect(executionRepository.updateExistingExecution).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should update execution', async () => {
|
test('should update execution when saving progress is enabled', async () => {
|
||||||
jest.spyOn(fnModule, 'toSaveSettings').mockReturnValue({
|
jest.spyOn(fnModule, 'toSaveSettings').mockReturnValue({
|
||||||
...commonSettings,
|
...commonSettings,
|
||||||
progress: true,
|
progress: true,
|
||||||
|
@ -86,6 +87,37 @@ test('should update execution', async () => {
|
||||||
expect(reporterSpy).not.toHaveBeenCalled();
|
expect(reporterSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should update execution when saving progress is disabled, but waitTill is defined', async () => {
|
||||||
|
jest.spyOn(fnModule, 'toSaveSettings').mockReturnValue({
|
||||||
|
...commonSettings,
|
||||||
|
progress: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const reporterSpy = jest.spyOn(ErrorReporterProxy, 'error');
|
||||||
|
|
||||||
|
executionRepository.findSingleExecution.mockResolvedValue({} as IExecutionResponse);
|
||||||
|
|
||||||
|
const args = deepCopy(commonArgs);
|
||||||
|
args[4].waitTill = new Date();
|
||||||
|
await saveExecutionProgress(...args);
|
||||||
|
|
||||||
|
expect(executionRepository.updateExistingExecution).toHaveBeenCalledWith('some-execution-id', {
|
||||||
|
data: {
|
||||||
|
executionData: undefined,
|
||||||
|
resultData: {
|
||||||
|
lastNodeExecuted: 'My Node',
|
||||||
|
runData: {
|
||||||
|
'My Node': [{}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
startData: {},
|
||||||
|
},
|
||||||
|
status: 'running',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(reporterSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
test('should report error on failure', async () => {
|
test('should report error on failure', async () => {
|
||||||
jest.spyOn(fnModule, 'toSaveSettings').mockReturnValue({
|
jest.spyOn(fnModule, 'toSaveSettings').mockReturnValue({
|
||||||
...commonSettings,
|
...commonSettings,
|
||||||
|
|
|
@ -16,7 +16,7 @@ export async function saveExecutionProgress(
|
||||||
) {
|
) {
|
||||||
const saveSettings = toSaveSettings(workflowData.settings);
|
const saveSettings = toSaveSettings(workflowData.settings);
|
||||||
|
|
||||||
if (!saveSettings.progress) return;
|
if (!saveSettings.progress && !executionData.waitTill) return;
|
||||||
|
|
||||||
const logger = Container.get(Logger);
|
const logger = Container.get(Logger);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue