Skip to content
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

feat: initiate retry on failure. #26

Closed
wants to merge 2 commits into from
Closed

feat: initiate retry on failure. #26

wants to merge 2 commits into from

Conversation

jiangtao-zzz
Copy link

@jiangtao-zzz jiangtao-zzz commented Aug 20, 2021

for example, when a slice fails to upload a large file, you need to try again.

Fixes #25

@rxaviers
Copy link
Owner

Thank you very much for the details in #25 and for this PR, now the point is clear to me. cc @JiangTaoZzzz

Instead of implementing the retry mechanism in this library/fn, would it be possible to do it in the user code itself? This way we keep this library/fn simple and we are still able to fulfill such usecase. For example:

async function mySuperUpload(...args) {
  if (!await uploadAndRetryACoupleOfTimesBeforeItFails(...args)) {
    throw new Error("...");
  }
  return ...;
}

await asyncPool(2, [dataSlice1, dataSlice2, ...], mySuperUpload);

@jiangtao-zzz
Copy link
Author

Oh, that's true. Your idea is better. Thank you very much, I got.

@rxaviers
Copy link
Owner

You're very welcome. I am going to close the PR and the linked issue. If there are any other points / use cases that can't be done this way, let me know. We can reconsider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to process the request
2 participants