Skip to content

Download retry count is off by one #836

Description

@grandpig

Problem

src/download.rs defines:

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

fuelup 0.27.4

Installed components

latest - Up to date
fuelup - Update available

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions