Skip to content

Commit

Permalink
allow cancelling execution with wait nodes (with timeout less than 65…
Browse files Browse the repository at this point in the history
… seconds)
  • Loading branch information
netroy committed Nov 10, 2023
1 parent 2124d1f commit 1e82cca
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/nodes-base/nodes/Wait/Wait.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,9 @@ export class Wait extends Webhook {
if (waitValue < 65000) {
// If wait time is shorter than 65 seconds leave execution active because
// we just check the database every 60 seconds.
return new Promise((resolve, _reject) => {
setTimeout(() => {
resolve([context.getInputData()]);
}, waitValue);
return new Promise((resolve, reject) => {
const timer = setTimeout(() => resolve([context.getInputData()]), waitValue);
context.onExecutionCancellation(async () => clearTimeout(timer), reject);
});
}

Expand Down

0 comments on commit 1e82cca

Please sign in to comment.