You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the below code, if the method that is being executed returns a rejected promise, the "completed" callback is never called.
As a result, the queue is left in a "running" state - which means it will not execute any other tasks and the entire environment has to be destroyed and re-created.
In case of such a failure I think it would make more sense to "reset" the generator and environment state to allow reusing it for subsequent run() calls.
functionaddMethod(method,methodName,queueName){queueName=queueName||'default';debug(`Queueing ${methodName} in ${queueName}`);self.env.runLoop.add(queueName,completed=>{debug(`Running ${methodName}`);self.emit(`method:${methodName}`);runAsync(function(){self.async=()=>this.async();returnmethod.apply(self,self.args);})().then(completed).catch(err=>{debug(`An error occured while running ${methodName}`,err);// Ensure we emit the error event outside the promise context so it won't be// swallowed when there's no listeners.setImmediate(()=>{self.emit('error',err);reject(err);});});});}
The text was updated successfully, but these errors were encountered:
In the below code, if the method that is being executed returns a rejected promise, the "completed" callback is never called.
As a result, the queue is left in a "running" state - which means it will not execute any other tasks and the entire environment has to be destroyed and re-created.
In case of such a failure I think it would make more sense to "reset" the generator and environment state to allow reusing it for subsequent run() calls.
The text was updated successfully, but these errors were encountered: