How does RetryAgent work? #2945
-
So I want to make use of RetryAgent + signal in my project to retry and endpoint. But then I came across this issue #1485 So I was wondering how do the 2 features work together? is it possible to achieve what im asking for? i.e. try endpoint, timeout after 1s, retry again for 2nd and 3rd attempt and finally fail. Also is it possible to do exponential backoff with retry agent? i see the retry options and retry context but I'm not sure how they interact. Maybe more in-depth examples are needed in the docs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
👋 To achieve what you are looking for, you can rely merely on the options set for your client/dispatcher to handle the timeout settings. On a timeout, and in combination with the To create an exponential-backoff-based Agent, it's enough to just pass the |
Beta Was this translation helpful? Give feedback.
👋
Indeed more in-depth examples in the docs will be really valuable.
To achieve what you are looking for, you can rely merely on the options set for your client/dispatcher to handle the timeout settings. On a timeout, and in combination with the
RetryHandler
, it will lead to a failure that the handler understands and will react accordingly.To create an exponential-backoff-based Agent, it's enough to just pass the
retry
callback when creating theRetryAgent/Handler
; thecontext
will pass you the current number of retries and the last timeout applied before the last retry. You can use these heuristics to alter the way the timeout is calculated and indicate to the handler when to move forwa…