Skip to content

Retry logic off by one #1

Description

@nursoltan-s

You're using while (attempt <= maxRetries) —
If maxRetries = 0, it still runs once, which is fine.
But if maxRetries = 3, it will attempt 4 times total (0, 1, 2, 3).
That’s ambiguous: “maxRetries = 3” usually means 3 retries after the first attempt (total 4), but many libraries treat it as total attempts = maxRetries.
You should clarify and adjust accordingly.

If you want maxRetries to mean “number of retries after first attempt”, this is fine — just document it.
Otherwise, change condition to while (attempt < maxRetries).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions