Questions tagged [retry-logic]

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

377 questions
1
vote
1 answer

Adding Polly Retry policy globally

I know you can register an IAsyncPolicy to a particular instance of an HttpClient injected into a service, but is there a way to configure this globally, to all HttpClients wired up via microsofts dependency injection? For…
1
vote
1 answer

how to debug and test retry logic of API client in Python

I've just developed the primitive API client for Instagram based on "requests" library. The next goal is to implement retry logic for 400+ and 500+ error codes. There is a bunch of examples how to do this, but I'm wondering how to test the…
1
vote
1 answer

Mockito unit testing a retry logic

I have a piece of code that retries when it fails with ExceptionOne, and if it continues to fail, it will throw a ExceptionTwo. I want to test this behavior, but am not sure how to. public void someMethod(String x) { boolean retry; int try =…
askaka12
  • 195
  • 2
  • 2
  • 9
1
vote
0 answers

HttpClient usage in polly

Wanted to verify if HttpCLient instance should be created outside method passed to polly for ExecuteAsync, or in? My current usage varies between the two options and I am not sure which is the correct one? Also, if it incurs some drawbacks, or…
o_w
  • 581
  • 3
  • 12
1
vote
1 answer

C# Retry two queries with Polly Retry

So I have 2 queries: var a = await _aQuery.Execute(aId); var b = await _bQuery.Execute(bId); How can I retry execution of these queries with Polly Retry so that if any of them succeeds to get a non-null value, the code can proceed? For example: 5…
tad
  • 21
  • 3
1
vote
1 answer

Troubleshooting Retry With Multiple Conditions

I currently have the below retry statement: * retry until karate.xmlPath(response, '//ResultCount') == 1 && karate.xmlPath(response, '//Code') == 0 If the retry fails, this message is printed: 'too many retry attempts: 10' The issue we are facing…
David A
  • 37
  • 3
1
vote
0 answers

Node fetch retry (3 attempts) only after failure of another retry (10 attempts) / Should I use throw new err() on that 10th try?

My apologies beforehand, because I'm finding it a bit difficult to explain the question at hand, so I'll divide it in parts. I'm trying to find the best way to trigger retries based on a failed final retry attempt from another function (retry of a…
Abak
  • 41
  • 1
  • 11
1
vote
0 answers

Do client libraries normally implement retry mechanisms?

I noticed that googleapiclient.discovery.build() calls a function that has num_retries as a field, so I think that means I don't have to implement retries & error handling when calling a function that takes care of that for me; is this the correct…
phamjamstudio
  • 93
  • 1
  • 5
1
vote
1 answer

How to execute a method the first time and on each retry?

I'm using Polly for a retry policy: var policy = Policy .Handle(x => x.DatabaseErrors.ContainsKey(2601)) .WaitAndRetry(new[] { TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(1000), …
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
1
vote
0 answers

Can the Spring Cloud AWS SQS ON_SUCCESS deletion policy create an infinite loop? Or does i t have retries?

I want to retry failed messages in my Spring Cloud SQS listener with something like: @SqsListener(value = [QUEUE_NAME], deletionPolicy = ON_SUCCESS) fun read(message: MyEvent) { But I am worried that if one specific event causes a deterministic…
borjab
  • 11,149
  • 6
  • 71
  • 98
1
vote
1 answer

Cant figure out Lambda retries

For some reason, I cannot replicate the retry capabilities stated in the docs in my lambda function at all. I set the Max event age to 1 min, and i set the max retry attempts to 2. Yet when a execute a simple lambda function like…
1
vote
0 answers

How to implement a kafka retry policy with publishing failed messages to a Dead Letter Topic in .NET?

I am searching on the internet to find a code example in .NET for implementing a kafka retry policy with publishing failed messages to a Dead Letter Topic (DLT/DLQ), but I can't find an example. Does someone has some tips or links for me?
1
vote
1 answer

Polly does not timeout

I am trying to get Polly to try again on timeout after 3 seconds and also when certain http codes are returned. However, it doesn't time out until after 100 seconds when the HttpClient times out. Here is my code: private static…
Niels Brinch
  • 3,033
  • 9
  • 48
  • 75
1
vote
1 answer

How to include a return statement when executing a Polly policy?

Below is my code in C# Windows application, where connection with Oracle, FTP and Null Reference Exception are handled: public Result Execute() { Result result = null; string errorMessage = string.Empty; var retryTimes = 1000; var…
Ch.
  • 77
  • 1
  • 10
1
vote
2 answers

Asyn retry Junit is not running for 3 times as default

I am working on junit test for failure scenario for retryable. It used to work fine until we have upgraded to new version of mockito and spring boot version. We have updated to spring boot 2.4.x and started seeing this issue. Service.java public…
JingJong
  • 207
  • 1
  • 3
  • 14