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 Apr 28, 2023
1 parent 5a0b49d commit 00f55f3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/nodes-base/nodes/Wait/Wait.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,10 +857,12 @@ export class Wait implements INodeType {
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([this.getInputData()]);
}, waitValue);
return new Promise((resolve, reject) => {
const timer = setTimeout(() => resolve([this.getInputData()]), waitValue);
this.onExecutionCancellation(() => {
clearTimeout(timer);
reject(new Error('Execution cancelled'));
});
});
}

Expand Down

0 comments on commit 00f55f3

Please sign in to comment.