You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the retry function in @azure/core-amqp contains a loop that includes a sleep that matches the user's retryDelayInMs if a retryable error is encountered while invoking the provided operation.
`The retry operation has been cancelled by the user.`
);
continue;
In the scenario where the final allowed attempt fails with a retryable error, this function will still apply the sleep before throwing the error. In @azure/event-hubs, which uses a default retryDelayInMs of 30000 (30 seconds), this means the user's application has to wait an extra 30 seconds between when the last error is encountered and when it is thrown to the user's code.
Instead, we should add a check to see if the total number of retry attempts have been exhausted, and if they have, skip the sleep.
The text was updated successfully, but these errors were encountered:
…e attempts are exhausted (#12698)
Fixes#12610
This change is pretty straightforward.
### Expected `retry` behavior:
If the operation passed to `retry` fails with a `retryable` error __and__ the maximum number of retries allowed has not been reached, `retry` should 'sleep' between operation attempts.
### Actual `retry` behavior pre-change:
If the operation passed to `retry` fails with a `retryable` error `retry` adds a 'sleep'.
This means that even if the final 'attempt' results in a retryable error being thrown, `retry` still sleeps before yielding the error to the calling code.
### Actual `retry` behavior post-change:
Matches the expected `retry` behavior. There is a 'sleep` only _between_ operation attempts, but not after all attempts have been exhausted.
Reference: #12587 (comment)
Currently the
retry
function in@azure/core-amqp
contains a loop that includes a sleep that matches the user'sretryDelayInMs
if a retryable error is encountered while invoking the provided operation.azure-sdk-for-js/sdk/core/core-amqp/src/retry.ts
Lines 232 to 244 in 1c2e8c4
In the scenario where the final allowed attempt fails with a retryable error, this function will still apply the sleep before throwing the error. In
@azure/event-hubs
, which uses a defaultretryDelayInMs
of 30000 (30 seconds), this means the user's application has to wait an extra 30 seconds between when the last error is encountered and when it is thrown to the user's code.Instead, we should add a check to see if the total number of retry attempts have been exhausted, and if they have, skip the sleep.
The text was updated successfully, but these errors were encountered: