Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
New Downloader for transient retries #553
New Downloader for transient retries #553
Changes from 4 commits
bc2df9e
d76619a
062791b
ad02cba
a0d7e44
f931f27
9569e69
f633e83
973c1a8
efc02a7
d475d4d
2c9f853
19344a7
ae4f536
ba58069
169a9af
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isn't documented; is it really better than
Any
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not restrict the constructor to only accepting
create_new_downloader
and thedownloader
field can just be used internally?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downloaders are stateful, and the original API promise was that you could decide how to share them, e.g. you could have 1 downloader per thread that you provision out. However this issue shows that we need the ability to create new ones as well. That makes me think actually the original API was bad and we probably should only have as input
create_new_downloader
like you say. However I think that's probably breaking, since we started by allowing you to pass in a Downloader. So my compromise here is that we'll use whatever downloader you pass in, but sometimes we will make a new one.But... it's even more complicated, because if we make a new one because we think the old one might have a problem, we don't want to use the old one anymore. But
DownloadsBackend
is immutable, so I don't have a way to replace the old one. We can replace AWS's global downloader, which is probably what most people are using, but if you were using the ability to provision downloaders on a per-request basis then we don't have a way to replace those.This API problem still has me stumped. The current implementation ONLY fixes things in a good way for users of the global downloader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest you have the following for backwards compatibility:
Using this doesn't work with your transient fixes but is effectively just uses the old behaviour. If you want the fix you need to pass in a function. I can't see another option for this as we can't
copy
instances ofDownloader
s.Why not make
DownloadsBackend
mutable or use aRef
for thedownloader
field?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried about concurrent access to the field: we can have multiple readers and at least one writer to the field. I suppose we can add a lock though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a lock and updated the constructors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to derail this PR but using undef when the downloader is not yet defined seems preferable
You'd just need to change some code in
get_downloader
to useisassigned(AWS_DOWNLOADER)
before dereferencingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that separately if we are going to change it. I vaguely remember some problems with that approach when trying it in the original implementation. Maybe it was useful to be able to reset back to nothing, or something like that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a transient error, not a throttling one, according to https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-retries.html#cli-usage-retries-modes-standard.title
However, in this PR only Downloads backend is getting special transient error handling, so maybe I should add this back with a comment, so we don't mess up the HTTP behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it later on as a separate check