[Docs] Add clarification about property precedence#1918
[Docs] Add clarification about property precedence#1918martintmk merged 18 commits intoApp-vNext:mainfrom
Conversation
|
I think it might make sense to add a little description to the retry page about how the following properties contribute in the calculation of the next delay: @martintmk, @martincostello Do you agree? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1918 +/- ##
=======================================
Coverage 84.79% 84.79%
=======================================
Files 312 312
Lines 6893 6893
Branches 1056 1056
=======================================
Hits 5845 5845
Misses 839 839
Partials 209 209
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Sure, sounds like a good idea. |
|
I've started to document the retry delay calculation algorithm. I would like to ask your feedback whether is too detailed or is it documented on good level? |
|
Maybe just give description to each property and how it's affects the calculation and then do a sample calculation for one of the backoff types? |
I thought about the same but I soon bumped into the problem that the general description is true only under specific circumstances. Like:
Or shall I create a table with three columns: |
Co-authored-by: Martin Costello <martin@martincostello.com>
docs/strategies/retry.md
Outdated
| - `BackoffType`: It specifies which calculation algorithm should run. | ||
| - `Delay`: If only this one is specified then it will be used as is. If others are defined as well then this will be used as a *base delay*. | ||
| - `DelayGenerator`: If specified then it will overwrite other properties based calculation. **Except** if it returns a negative `TimeSpan` where the other properties based calculation is used. | ||
| - `MaxDelay`: If specified then it caps the delay if the calculated one is greater than this value. **Except** if `DelayGenerator` is used where no capping is applied. |
There was a problem hiding this comment.
| - `MaxDelay`: If specified then it caps the delay if the calculated one is greater than this value. **Except** if `DelayGenerator` is used where no capping is applied. | |
| - `MaxDelay`: If specified then it caps the delay if the calculated one is greater than this value. **Except** if `DelayGenerator` is used where no capping is applied. |
Just wondering, shall we apply the capping to values produced by generator too?
There was a problem hiding this comment.
I would say yes. That was my intuition before I checked the implementation. But let's deal with that in a separate PR if you don't mind.
There was a problem hiding this comment.
My intuition says yes too, the less special cases, the better. The only downside is that sometimes the Retry-After won't be fully respected if the value is greater than MaxDelay.
Thoughts @martincostello
There was a problem hiding this comment.
I would agree we should apply it - Retry-After isn't necessarily authoritative and the user may wish to try earlier by overriding. If we do that we should make it clear in the documentation.
There was a problem hiding this comment.
It is a concision decision by the strategy configurator that (s)he sets the MaxDelay. If it is set then the strategy should cap the value regardless how it is calculated/retrieved IMHO.
|
|
||
| The `BackoffType` property's data type is the [`DelayBackOffType`](xref:Polly.DelayBackOffType) enumeration. This primarily controls how the calculation is done. | ||
|
|
||
| ### Constant |
There was a problem hiding this comment.
| ### Constant | |
| ### Example calculation | |
| Below is the example calculation for `Constant` delay type. It showcases how the delay is calculated, the calculation is almost identical for the other (`Linear`, `Exponential`) backoff types. |
Or something in that sense.




Pull Request
The issue or feature being addressed
#1916
Details on the issue fix or feature implementation
TimeoutandTimeoutGeneratorBreakDurationandBreakDurationGeneratorDelayandDelayGeneratorInjectionRateandInjectionRateGeneratorExtra
Confirm the following