req
req copied to clipboard
`retry`: `retry_delay` fun gets called 4 times with `max_retries: 3`
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.
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.