-
Notifications
You must be signed in to change notification settings - Fork 10
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 #18: Retry FileDownloads #23
Conversation
Now that we know (hopefully) why the test was failing, we know that this is doable. Unfortunately, this is messy and would require a long discussion and some strategic decisions, so lets begin that by splitting the problem in multiple topics and try to agree on them. Here is the first one: The client makes several types of requests:
My intuition here is to:
What do you think? |
I agree with all your intuitions! To repeat:
Now that we agree on which requests should actually retry, did you have next steps in mind? |
OK, Yes, multiple next steps :) Next question: We have 2 separate retries to handle. Let's call them
If we chose option 1, it means that we have to:
If we chose option 2, it means that we have to:
What do you think? P.S.:
|
Personally, I lean towards Option 2 because it's more direct – if people want to retry file downloads, they can read through the options and README and find the If we do go with Option 2, I'll make sure that the order of arguments are such that In either case, as far as not having access to calculateDelay, I'm sad but I agree it's not worth the effort right now. If users want to use a long delay, we can encourage them to set retries high; the built-in exponential backoff should help with that. |
OK, I am not a big fan of either option and it is quite hard to decide, so let's skip it for now and hope that it will become clearer while doing the rest. The next one should be simple. Even though is not configured this way by default, one might need to be able to retry successful requests. For example retry on 304 (not modified) until you get 200. I know you don't exactly support such config now, but that is a question for another step. That said, can we agree that this makes sense and can you move https://github.com/smart-on-fhir/bulk-data-client/blob/dtp/18-manual-retry/src/lib/FileDownload.ts#L152-L159 outside (before) its containing if statement Also, do we need to wait to call |
I agree, we can move the manual shouldRetry check outside of the wrapping if-statement. Good catch, I'll do that now.
I could not agree more ^ 😆 |
…tead of specific variables; TODO determine calculateDelay approach
…nition of retry object in fileDownload
…oaded test/tmp/config
Thanks Dylan! I tested it and it seems to work fine! |
Having trouble debugging some weird test issues, so I figure I'll make a PR and two-birds-one-stone the problem along with the code review.
Addresses #18 by manually triggering re-downloads of files in the event that FileDownload's streaming requests trigger one of several HTTP status codes in response. Additionally, this PR adds two new configuration values (yay, more config variables) for customizing this retry behavior:
fileDownloadMaxRetries
andfileDownloadRetryAfterMSec
.To test, modify the bulk-data-server repo to track the number of attempts made to a file download before succeeding. I'd push a branch but I don't have push permissions now so for the moment forgive the awkward git diff formatting:
Things to consider:
fileDownloadRetryAfterMSec
withretryAfterMSec
?retry-after
header, we don't want to make the responsibility of this variable ambiguous. Plus, the rate at which we retry for status updates might resonably differ from the rate at which we retry failed requests.request
option directly..js
files, so users could define them inline, but it does feel cumbersome to have users specify a delay fn instead of a number.