Questions tagged [retry-logic]

Programming techniques designed to retry operations that failed due to error codes, exceptions, or other language specific means.

377 questions
2
votes
0 answers

Polly .Net shut down application gracefully with IHostApplicationLifetime

The end outcome is to shut down the application if a specific type of exception (DatabaseException) has occurred. However the current method HandleDatabaseException does not stop the application, the execution will carry on. Even though the…
DrExpresso
  • 73
  • 1
  • 7
2
votes
0 answers

Istio strips header when added via EnvoyFilter

I'm trying to add a specific "x-envoy..." header on the inbound request to a specific workload. More precisely it's the x-envoy-max-retries header. I do it like this: apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name:…
Mr. Nicky
  • 1,519
  • 3
  • 18
  • 34
2
votes
0 answers

Python requests/urrllib3 - Retry on read timeout after 200 header received

I'm using requests to download some large files (100-5000 MB). I'm using session and urllib3.Retry to get automatic retries. It appears such retries only applies before the HTTP Header has been received and content has started streaming. After 200…
ee555
  • 21
  • 1
2
votes
1 answer

Is there any way to add Polly retry policy to all HttpClients created from HttpClientFactory?

I have a class A which has a GetClient method that creates named-HttpClients using HttpClientFactory, like this: public class A : AInterface { A (IHttpClientFactory factory, ...) { _httpClientFactory = factory; } private…
sg1993
  • 335
  • 2
  • 19
2
votes
2 answers

Ruby - retry function with different params

I'd like to retry a function with different params depending on the result of the first iteration: Giving a retry function like follow: def retry_on_fail(**args) yield rescue StandardError => e args = args.merge(different_param => true) if…
2
votes
1 answer

Can I define retry mechanism for RabbitMQ message producer in SpringBoot?

I have the following RabbitMQ setup in the application.yml in my SpringBoot app which can consume (receive) messages: spring: rabbitmq: host: localhost port: 5672 username: admin password: password listener: simple: …
victorio
  • 6,224
  • 24
  • 77
  • 113
2
votes
2 answers

Unit test sleep durations polly wait retry policy

I wanted to write a unit test to see if the execution is put to sleep for the specified duration. I have come across the SystemClock which is part of Polly.Utilities, but I'm looking for the implementation similar to Polly unit test as mentioned…
2
votes
1 answer

How to execute a Polly policy for all elements of an IEnumerable, and stop on first unhandled exception

The policies of the Polly library, for example Bulkhead, Retry etc, contain a method ExecuteAsync with many overloads (18), but none of them allows to execute the policy for all elements of an IEnumerable and gather the results. It seems that the…
Theodor Zoulias
  • 34,835
  • 7
  • 69
  • 104
2
votes
1 answer

Cannot make Polly Timeout Policy override the HttpClient default timeout

I am using a Polly retry policy and as expected during that retry processes the HttpClient hits its 100 second timeout. I have tried a couple of different ways to incorporate the Polly Timeout policy to move the timeout to per retry instead of…
SOHO Developer
  • 583
  • 4
  • 16
2
votes
1 answer

Get the full URI within a Polly retry attempt?

I'm using Polly to retry HttpClient attemnpts : services.AddHttpClient(jp => { jp.BaseAddress = new Uri(appSettings.JoinPackageWS.BaseUrl); }) .AddPolicyHandler(GetRetryPolicy(appSettings,…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
2
votes
1 answer

Retry a message in KafkaStreams Topology

I have a kafkaStreams Topology in which there is a Processor API. Inside the processor, there is a logic to call an external API. Incase the API returns 503, the message tried will need to be retried. Now, am trying to push this message to a…
2
votes
2 answers

Ansible ERROR! 'retries' is not a valid attribute for a TaskInclude

My requirement is to run the script stop-all as many times (5 retries) until the output of ps -fu user1 |wc -l becomes less than 2. I wrote the below ansible playbook for the same: cat stop.yml - hosts: dest_nodes tasks: - name: Start…
Ashar
  • 2,942
  • 10
  • 58
  • 122
2
votes
1 answer

@Recover is not working if @Retryable returns a value

I am trying to implement retry logic. my code is working as expected until return type of retry method is void. the moment I change it to String, @Recover stops working. @Component public class AdapterImpl { int count = 0; …
shrikant.sharma
  • 203
  • 1
  • 17
  • 37
2
votes
1 answer

getting conversion error while trying to wrap 2 Polly policies

I am trying to wrap two Polly policies and want to return IAsyncPolicy, but it giving error, convert from Polly.Retry.RetryPolicy < System.Net.Http.HttpResponseMessage> to Polly.IAsyncPolicy public static IAsyncPolicy CreateDefaultRetryPolicy() …
user584018
  • 10,186
  • 15
  • 74
  • 160
2
votes
2 answers

timer wrapper function for recursive async/await call

I have a recursive async function getResponse(url,attempts = 0), which polls external api for the response and resolves or exits after reaching X number of retries or on a server error. However, it's internal "clock" is based off the number of…
denis
  • 53
  • 1
  • 4