Closed ig-sinicyn closed 3 years ago
Unrelated to this PR , it feels that infiniteIfDefault is not so descriptive. It simply means treat Zero or negative as Infinite.
Unrelated to this PR , it feels that infiniteIfDefault is not so descriptive. It simply means treat Zero or negative as Infinite.
@NN--- , I do strongly agree. I was not able to find better argument name so suggestions are welcome!:)
zeroOrNegativeAsInfinite Better?:)
zeroOrNegativeAsInfinite
Well, the name will not match the behavior in case of zeroOrNegativeAsInfinite: false
.
The meaning of arg is following
-1ms
) infiniteIfDefault: true
:
x > 0 - keep as is
x <= 0 - replace with infinite value (-1ms
)Maybe it should have been enum ? :) Let's have it as-is then.
Let's have it as-is then.
Ok!:)
It's worth fixing readme.txt
This PR fixes a bug in
timeSpan.AdjustTimeout(TimeSpan maximumValue)
overload. The AdjustTimeout() helper is meant to be used for user-specified timeouts to make it safe to pass timeout value into FW methods. As example, Task.Delay(timeout) will throw if the timeout is negative and not equal to -1ms.As a bonus, there was
.AdjustTimeout(maximumValue)
overload that ensure that timeout will never be larger than maximumValue arg. This design was counterintuitive as customers did expect behavior similar to.GetValueOrDefault()
method.Current implementation fixes the WTF moment and changes behavior of the overload to match user expectations. It now works as
.AdjustTimeout(defaultValue)
. This is a breaking change but it is much less traumatizing for a new customers.Old behavior moved into its own AdjustAndLimitTimeout() method.