forwardemail / forwardemail/superagent

Support tail off delay in retry

Open
#1,644 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Often when retrying a request it is useful to have a throttle back on the time between requests to prevent hitting the remote server in quick succession, but also to allow some time for potential issues to resolve.

I can see two potential ways that this could be easily handled in the .retry() function.

1. Accept an array of intervals in ms similar to the interface for `superagent-retyr-delay`. Each interval would be applied per request in order

2. Support the returing of promises in the callback function passed to retry. This would allow much greater scope for functionionality including the ability for the user to await some timeout before returning true/false.

The later is my preferred option, but returning Promises in callbacks is a bit...urgh.

I believe I can implement either option as a PR if desired.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.