-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - awaitNextInterval #205
Comments
What exactly would |
const promises = myObjects.map(obj => {
const cb = async () => {
return myApiCall(obj.id).catch(err => {
if (err.code === HttpStatus.TOO_MANY_REQUESTS) {
//queue.awaitNextInterval()
return queue.add(cb, { priority: 999999 });
}
this.logger.error(`failed with:`, err);
});
};
return cb;
});
await queue.addAll(promises); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using the p-queue for throttling, where potentially the API I am trying to hit could still rate limit me.
It would be great if there was a function I could use to handle those timeout after I catch the errors.
The text was updated successfully, but these errors were encountered: