Skip to content

feat: add retry logic and extended timeouts for large file downloads#91

Merged
flexiondotorg merged 1 commit intomainfrom
pr-86
Jan 22, 2026
Merged

feat: add retry logic and extended timeouts for large file downloads#91
flexiondotorg merged 1 commit intomainfrom
pr-86

Conversation

@flexiondotorg
Copy link
Member

@flexiondotorg flexiondotorg commented Jan 22, 2026

  • Add automatic retry mechanism with exponential backoff (3 retries max)
  • Implement automatic resume on retry by re-checking file size
  • Extend connection timeout to 10 minutes for large file downloads
  • Add connection pooling and TCP keepalive settings
  • Refactor download_file_content to handle transient network errors
  • Simplify function signature by removing explicit file_size parameter

Addresses issues:

Changes from PR #86 by @ApfelTeeSaft


Summary by cubic

Adds automatic retry with exponential backoff and resume, plus longer connection timeouts and keepalive, to make large file downloads reliable. Resolves #76 (size/hash mismatches) and #89 (“error decoding response body”).

Written for commit 74bc8ad. Summary will update on new commits.

- Add automatic retry mechanism with exponential backoff (3 retries max)
- Implement automatic resume on retry by re-checking file size
- Extend connection timeout to 10 minutes for large file downloads
- Add connection pooling and TCP keepalive settings
- Refactor download_file_content to handle transient network errors
- Simplify function signature by removing explicit file_size parameter

Addresses issues:
- #76: Large files downloading with incorrect size/hash errors
- #89: Connection errors during download ('error decoding response body')

Changes from PR #86 by @ApfelTeeSaft
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/main.rs">

<violation number="1" location="src/main.rs:25">
P2: Magic number `60` should use the existing `HTTP_TIMEOUT` constant. The PR removed the import but hardcoded the same value, which defeats the purpose of having the constant and makes future maintenance harder.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

let response = client
.head(url)
.timeout(std::time::Duration::from_secs(HTTP_TIMEOUT))
.timeout(std::time::Duration::from_secs(60))
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Magic number 60 should use the existing HTTP_TIMEOUT constant. The PR removed the import but hardcoded the same value, which defeats the purpose of having the constant and makes future maintenance harder.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main.rs, line 25:

<comment>Magic number `60` should use the existing `HTTP_TIMEOUT` constant. The PR removed the import but hardcoded the same value, which defeats the purpose of having the constant and makes future maintenance harder.</comment>

<file context>
@@ -8,18 +8,21 @@
     let response = client
         .head(url)
-        .timeout(std::time::Duration::from_secs(HTTP_TIMEOUT))
+        .timeout(std::time::Duration::from_secs(60))
         .send()
         .await?;
</file context>
Fix with Cubic

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed the magic number issue by replacing the hardcoded 60 with the existing HTTP_TIMEOUT constant from ia_get::constants.

Changes made:

  • Added HTTP_TIMEOUT to the import statement on line 11
  • Replaced 60 with HTTP_TIMEOUT on line 25

This ensures consistency with the defined constant and makes future maintenance easier.

PR: #92

@flexiondotorg flexiondotorg merged commit bdf5359 into main Jan 22, 2026
7 checks passed
@flexiondotorg flexiondotorg deleted the pr-86 branch January 22, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hash error - only less size files downloaded

1 participant