Skip to content

Conversation

@iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Jan 5, 2026

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.

@iLLiCiTiT iLLiCiTiT self-assigned this Jan 5, 2026
@iLLiCiTiT iLLiCiTiT requested a review from BigRoy January 5, 2026 13:02
@iLLiCiTiT iLLiCiTiT added the type: bug Something isn't working label Jan 5, 2026
@iLLiCiTiT iLLiCiTiT changed the title set content size only once Download: Set content size only once Jan 5, 2026
Copy link
Contributor

@BigRoy BigRoy left a 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?

@iLLiCiTiT
Copy link
Member Author

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.

@BigRoy
Copy link
Contributor

BigRoy commented Jan 5, 2026

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.

@iLLiCiTiT
Copy link
Member Author

iLLiCiTiT commented Jan 6, 2026

I don't really see how this influences it

It doesn't influence it, the content size is already known. And TransferProgress allows to set content size only once https://github.com/ynput/ayon-python-api/blob/develop/ayon_api/utils.py#L832

Comment on lines 1381 to 1385
if not content_size_set:
content_size_set = True
progress.set_content_size(
response.headers["Content-length"]
)
Copy link
Contributor

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?

Copy link
Contributor

@BigRoy BigRoy left a 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.

@iLLiCiTiT iLLiCiTiT merged commit b7d097e into develop Jan 6, 2026
2 checks passed
@iLLiCiTiT iLLiCiTiT deleted the bugfix/294-keyerror-content-length-on-v127 branch January 6, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants