Download retry count is off by one
- Dominant language
- Rust
- Stars
- 282
- Forks
- 150
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 2
Description
### Problem
`src/download.rs` defines:
```rust
const RETRY_ATTEMPTS: u8 = 4;
```
However, both `download()` and `download_file()` iterate with:
`for _ in 1..RETRY_ATTEMPTS`
Because Rust ranges exclude the upper bound, 1..4 only produces three iterations. As a result, the downloader performs at most three HTTP requests instead of the configured four attempts.
The retry logic currently applies to HTTP 404 responses; other errors return immediately.
### Steps
The configured attempt count should match the number of HTTP requests made.
### Possible Solution(s)
Use an inclusive range such as:
`for attempt in 1..=RETRY_ATTEMPTS`
or:
`for _ in 0..RETRY_ATTEMPTS`
The final error could also include the URL and the number of attempts made. The retry delay should not be applied after the final failed attempt.
### Notes
_No response_
### Fuelup version
```console
fuelup 0.27.4
```
### Installed components
```console
latest - Up to date
fuelup - Update available
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/download.rs by reading the retry loops in download() and download_file(). Verify how the ranges control HTTP requests and delay handling, then adjust the attempt counting so four configured attempts produce four requests without delaying after the final failure. Confirm the downloader still retries HTTP 404 responses and returns other errors immediately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100