-
Notifications
You must be signed in to change notification settings - Fork 12
Download: Set content size only once #295
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
Conversation
BigRoy
left a comment
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.
Bit confused by this change. So does this mean only the initial response contains the Content-length? Or is this just an 'optimization' at this point?
If it fails in the middle it continues where it ended, content size is already known. |
I don't really see how this influences it - and like you I'm unsure how to really test this easily. |
It doesn't influence it, the content size is already known. And |
ayon_api/server_api.py
Outdated
| if not content_size_set: | ||
| content_size_set = True | ||
| progress.set_content_size( | ||
| response.headers["Content-length"] | ||
| ) |
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 do if progress.get_content_size() is None: - instead of having a local variable here to maintain?
BigRoy
left a comment
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.
Looks fine to me.
Changelog Description
Set content length only once. If download fails in the middle.
Testing notes:
Not sure how to test, it would have to fail in the middle of download.