Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry: retry_delay fun gets called 4 times with max_retries: 3 #308

Closed
lud-wj opened this issue Feb 19, 2024 · 1 comment
Closed

retry: retry_delay fun gets called 4 times with max_retries: 3 #308

lud-wj opened this issue Feb 19, 2024 · 1 comment

Comments

@lud-wj
Copy link

lud-wj commented Feb 19, 2024

If the function should return a delay for a retry, configuring max_retries: 3 should result in 3 calls for the function only, not 4.

(Actually the callback is called 2 times for each index, so 8 calls in total)

I am trying to configure our code with the correct delays, so I would like to know what to return when the passed index is 0. As far as I can tell it is indeed the delay between the first attempt and the second attempt (aka retry 0), and the last call to the callback (after max_retries is exhausted) has its return value discarded.

So if I want my code to work, my list of delay values should be validate length(delay_list) == max_retries + 1, So for max_retries: 3 I need a list of length 4 (indices 0..3).

Is that correct?

Thank you.

@wojtekmach
Copy link
Owner

wojtekmach commented Feb 19, 2024

Thank you for the report. with max_retries: 3 Req will make 4 request total, the initial one and 3 retries. There's definitely a bug. I also think the delay function should be called 3 times. That'd be my guess too that we calculate the retry delay before we figure out we hit the max retries. That it's additionally is called two times per retry is definitely a bug too. The retry logic with all the options went a bit out of the hand so it needs a rethink and possibly a re-implementation.

@wojtekmach wojtekmach changed the title retry_delay fun gets called 4 times with max_retries: 3 retry: retry_delay fun gets called 4 times with max_retries: 3 Mar 22, 2024
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

No branches or pull requests

2 participants