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
I am using AbortController to abort my promises. However when aborting, rather than immediate rejection of all pending promises, the library continues to throttle and reject ends up taking more time. E.g if there are 50 promises with throttle of 1 req/sec, you'll end up with 50 seconds for abort to finish.
Below is the code sequence I run. Is there anything I'm missing?
constpromiseThrottle=newPromiseThrottle({requestsPerSecond: 1,promiseImplementation: Promise// the Promise library you are using});letcontroller=newAbortController();letsignal=controller.signal;letmyPromises=[];myPromises.push[promiseThrottle.add(my_axios_api,{ signal })];myPromises.push[promiseThrottle.add(my_axios_api{ signal })];returnPromise.all(myPromises);
// and elsewhere , i loop and poll, if cancel should be abortedthis.cancelPoller=setInterval(()=>{if(this.shouldCancelUpload()){controller.abort();}},1000);//check every 1 second if upload has to be cancelled
The text was updated successfully, but these errors were encountered:
At the moment if you pass the signal to a single promise it will cancel that promise. The library doesn't take into account the case in which you are using the same signal for several promises added individually.
I think you can apply the example shown in the README file, where the signal is passed to the whole set of promises queued.
I am using
AbortController
to abort my promises. However when aborting, rather than immediate rejection of all pending promises, the library continues to throttle and reject ends up taking more time. E.g if there are 50 promises with throttle of 1 req/sec, you'll end up with 50 seconds for abort to finish.Below is the code sequence I run. Is there anything I'm missing?
The text was updated successfully, but these errors were encountered: