Fix file transfers ignoring connection 'max_retries' - #358
Merged
Merged
Conversation
Uploads and downloads used 'get_default_max_retries()' (env variable or class default) instead of the connection's 'max_retries', and did not ensure at least one attempt. With 'AYON_SERVER_RETRIES=0' an upload crashed with AttributeError on 'None' response and a download silently did not download anything. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Download continuation with 'Range' header did not check the response is partial content (206). A server ignoring 'Range' sends the whole file, which was appended to already downloaded content. - Downloaded size was never compared to 'Content-Length', so a download closed before all content was received was accepted as complete. It is now continued as another attempt, also on ChunkedEncodingError. - 'Content-Length' was stored as string and missing header raised KeyError. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
BigRoy
added this pull request to stack #362
September 12, 2026 22:18
iLLiCiTiT
approved these changes
Sep 14, 2026
BigRoy
requested review from
iLLiCiTiT
and
a lite review from Copilot
and removed request for
Copilot
September 14, 2026 14:40
BigRoy
marked this pull request as ready for review
September 14, 2026 14:40
BigRoy
removed this pull request from stack #362
September 14, 2026 14:41
Fix corrupted or incomplete files after interrupted download
iLLiCiTiT
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
File uploads and downloads ignore the connection's
max_retriesand can end up making zero attempts:con.set_max_retries(1)(orServerAPI(..., max_retries=1)) has no effect on transfers; they always use the env variable / class default (3).AYON_SERVER_RETRIES=0:AttributeError: 'NoneType' object has no attribute 'raise_for_status'Cause
_upload_fileand_download_file_to_streamusedself.get_default_max_retries()instead ofself.max_retries, and loopedfor attempt in range(retries)without ensuring at least one attempt. REST requests (_do_rest_request) already clamp to at least 1.Fix
Use
max(self.max_retries, 1)in both transfer functions.Reproduce
Download with zero retries:
Testing notes
tests/test_transfer_max_retries.py: zero retries still uploads/downloads;max_retries=1makes exactly one upload attempt.Stacked PRs touching the same download/upload loop build on top of this branch.
🤖 Generated with Claude Code