Hi,
Thanks for a great library.
I need to be able to mix preemptive timeout (i.e. consider a call failed if it times out within a budgeted timeout period rather than default longer call timeouts such as SQL or HTTP) with transient failure handling.
So does Polly support preemptive timeout? If yes how and if no, would you accept PR for it?
hi @aliostad . You should be able to do this with Polly v5.0's new Timeout policy, then using the new PolicyWrap to combine in a retry policy:
TimeoutPolicy timeout = Policy.Timeout(myOverallTimeBudget);
RetryPolicy retry = Policy.Handle<WhateverException>.Retry(/* my retry choices */);
PolicyWrap retryWithTimeout = timeout.Wrap(retry); // Wrap them in the other order if you want the timeout per call, not per overall strategy
retryWithTimeout.Execute(cancellationToken => DoSomething(cancellationToken));
(Just an example: you can do all that both sync/async, for generic <TResult> executions/policies too, and for all flavours of retry.)
More:
Polly v5.0 is in alpha on nuget. Expecting RTM sometime in the next 2-3 weeks. No change to above features expected for RTM.
Let us know if that gets you going, or if we can help more. All feature feedback welcome!
That sounds great.
Is there a way to adapt the timeout based on a the percentile of the existing response times?
@aliostad TimeoutPolicy has a configuration overload taking a Func<TimeSpan>, so certainly possible to configure a policy where you can vary the timeouts in real-time (thanks to @brunolauze and @mfjerome for this original idea).
Re percentiles of existing response times, Polly does not yet provide these stats, but emitting such events/metrics is a major part of the forward roadmap for 2017 (taking Polly in the metrics/dashboarding direction which Hystrix offers for Java).
@aliostad Are you (/any teams you work with) interested in being involved in the metrics development effort? It's a major piece of work, which will benefit from more community resource.
There鈥檚 already been prior discussion on our slack channel, and some folks from Canada and Pivotal in the US are interested, too.
Hi,
This is exactly what I am looking for. I considered porting Hysterix but I knew you guys done work in the area so preferred to see if this were available.
We heavily do metrics, ingesting 1TB of logs a day in ASOS - the overall architecture is Microservices not too different from that of Netflix and Uber. I will join you on the conversations.
Thanks once again for the hard work. Keep it up.
Most helpful comment
hi @aliostad . You should be able to do this with Polly v5.0's new Timeout policy, then using the new PolicyWrap to combine in a retry policy:
(Just an example: you can do all that both sync/async, for generic
<TResult>executions/policies too, and for all flavours of retry.)More:
Polly v5.0 is in alpha on nuget. Expecting RTM sometime in the next 2-3 weeks. No change to above features expected for RTM.
Let us know if that gets you going, or if we can help more. All feature feedback welcome!