fix: Always set the retry attempt to 0 for now#1251
fix: Always set the retry attempt to 0 for now#1251danieljbruce merged 5 commits intogoogleapis:mainfrom
Conversation
If the retry attempt is greater than 1 then a library called retryRequest creates a large delay. If we force the retry count to be 0 then we skip this delay and the requests run in the required timeline.
|
|
||
| const retryOpts = { | ||
| currentRetryAttempt: numConsecutiveErrors, | ||
| currentRetryAttempt: 0, // was numConsecutiveErrors |
There was a problem hiding this comment.
Do you know why "numConsecutiveErrors" doesn't work here even though its value is 0 according to Line 730?
There was a problem hiding this comment.
numConsecutiveErrors works, but if it is greater than 0 then that will make the request take longer. Note that the number of consecutive errors is incremented at
Line 924 in 44fab5c
There was a problem hiding this comment.
I found this
calculatedNextRetryDelay = config.initialRetryDelayMillis * Math.pow(config.retryDelayMultiplier, numConsecutiveErrors)
It implies that when it's executed for the first time (i.e. the original request has failure), numConsecutiveErrors should be 0 such that the retry delay is config.initialRetryDelayMillis
There was a problem hiding this comment.
Keep in mind that the change in the PR doesn't affect this code. This is a delay that happens in the veneer layer while the delay in retryRequest happens below the veneer layer.
|
|
||
| const retryOpts = { | ||
| currentRetryAttempt: numConsecutiveErrors, | ||
| currentRetryAttempt: 0, // was numConsecutiveErrors |
There was a problem hiding this comment.
I found this
calculatedNextRetryDelay = config.initialRetryDelayMillis * Math.pow(config.retryDelayMultiplier, numConsecutiveErrors)
It implies that when it's executed for the first time (i.e. the original request has failure), numConsecutiveErrors should be 0 such that the retry delay is config.initialRetryDelayMillis
If the retry attempt is greater than 1 then a library called retryRequest creates a large delay. If we force the retry count to be 0 then we skip this delay and the requests run in the required timeline.