-
Notifications
You must be signed in to change notification settings - Fork 53
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
Can onRetry handle async functions? #43
Comments
Any update on this? I added an To follow on from your example: return retry(
async (_, attempt) => {
await downloadFileFromInternet();
},
{
onRetry: async (err) => {
// It happens that downloaded file has an error
// I want to delete the downloaded corrupted file
await fs.unlink(pathToCorruptedFile); // This does not wait
},
retries: 3
}
); |
Actually, are you sure? In my case await in onRetry() seems to work just fine |
When I was facing this problem I was fairly sure that was the problem. I now use p-retry instead. |
I'm sure that the onRetry() is not awaited... It seems we will need to drop the usage of this package because for this reason as there is no workaround and its easier then rewriting everythin we need to use in onRetry to a synchronous implementation. |
I have this situation where I download the file, and want to delete this file (async operation) if the downloaded file is corrupted and needs retry.
Is it possible to have async-retry retry the next attempt only once the onRetry resolves (if the return value is a Promise)?
The text was updated successfully, but these errors were encountered: