[Feature request]: Add TimeProvider argument to resilience extension methods
silkfire opened this issue · comments
Is your feature request related to a specific problem? Or an existing feature?
When creating a ResiliencePipelineBuilder, the consumer is offered to set a custom ITimeProvider by setting the TimeProvider property on the builder. This is not possible when using e.g. HTTP resilience extension methods like AddStandardResilienceHandler as the builder is created internally.
Describe the solution you'd like
It'd be useful if an overload was provided that allows the consumer of the extension methods to specify a ITimeProvider argument of their own choice, so as to increase flexibility for e.g. unit tests.
Additional context
No response
Could you clarify exactly which methods you want this added to?
If it's the AddStandardResilienceHandler()
methods, they don't live in this repository but in dotnet/extensions.
The methods I was referring to were AddStandardResiliencePipeline
and AddResiliencePipeline
. I wasn't actually aware that they belonged to a different repository. Should I open an issue there instead?
I don't seem to be able to find AddStandardResiliencePipeline()
in either repository with GitHub code search. AddStandardResilienceHandler()
is in dotnt/extensions, where as AddResiliencePipeline()
lives here.
@silkfire If TimeProvider
is registered in the DI, the AddResiliencePipeline
will automatically use and assign it:
I don't seem to be able to find
AddStandardResiliencePipeline()
in either repository with GitHub code search.AddStandardResilienceHandler()
is in dotnt/extensions, where asAddResiliencePipeline()
lives here.
Apologies, it was late and I got the methods mixed up. The one I intended was AddStandardResilienceHandler()
.
@silkfire If
TimeProvider
is registered in the DI, theAddResiliencePipeline
will automatically use and assign it:
Interesting, I wasn't aware of that, this might actually be sufficient for my use case. Thank you.