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).
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).