Skip to content

Commit

Permalink
Fix .perform() command node promise getting resolve early.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Jan 6, 2025
1 parent 8ee74c4 commit f87846f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/api/client-commands/perform.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ class Perform extends EventEmitter {
return true;
}

static get avoidPrematureParentNodeResolution() {
return true;
}

command(callback = function() {}) {
let doneCallback;
let asyncHookTimeout = this.client.settings.globals.asyncHookTimeout;
const asyncHookTimeout = this.client.settings.globals.asyncHookTimeout;

this.timeoutId = setTimeout(() => {
this.emit('error', new Error(`Timeout while waiting (${asyncHookTimeout}ms) for the .perform() command callback to be called.`));
Expand Down Expand Up @@ -99,7 +103,7 @@ class Perform extends EventEmitter {
};
} else {
doneCallback = () => {
let args = [(result) => {
const args = [(result) => {
clearTimeout(this.timeoutId);
this.emit('complete', result);
}];
Expand Down

0 comments on commit f87846f

Please sign in to comment.