mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix remaining test
This commit is contained in:
parent
c7ed0485f9
commit
1c768b7199
|
@ -94,10 +94,19 @@ describe('ActiveExecutions', () => {
|
|||
});
|
||||
|
||||
test('Should remove an existing execution', async () => {
|
||||
// ARRANGE
|
||||
const newExecution = mockExecutionData();
|
||||
const executionId = await activeExecutions.add(newExecution);
|
||||
|
||||
// ACT
|
||||
activeExecutions.finishExecution(executionId);
|
||||
|
||||
// TODO: Wait 2 ticks. This will be unnecessary once the `setImmediate` in
|
||||
// `active-executions` is removed.
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
|
||||
// ASSERT
|
||||
expect(activeExecutions.getActiveExecutions().length).toBe(0);
|
||||
});
|
||||
|
||||
|
|
|
@ -106,12 +106,16 @@ export class ActiveExecutions {
|
|||
};
|
||||
|
||||
// Automatically remove execution once the postExecutePromise settles
|
||||
void postExecutePromise.promise.finally(() => {
|
||||
this.concurrencyControl.release({ mode: executionData.executionMode });
|
||||
setImmediate(() => {
|
||||
delete this.activeExecutions[executionId];
|
||||
});
|
||||
});
|
||||
void postExecutePromise.promise
|
||||
.finally(() => {
|
||||
this.concurrencyControl.release({ mode: executionData.executionMode });
|
||||
setImmediate(() => {
|
||||
delete this.activeExecutions[executionId];
|
||||
});
|
||||
})
|
||||
// Attach a no-op handler to prevent an unhandled rejection, because
|
||||
// finally will not handle it, but rather rethrow it.
|
||||
.catch(() => {});
|
||||
|
||||
return executionId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue