Questions tagged [retry-logic]

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

377 questions
4
votes
2 answers

Polly retry policy with sql holding transaction open

I am using Polly to implement a retry policy for transient SQL errors. The issue is I need to wrap my db calls up in a transaction (because if any one fails, I want to rollback). This was easy before I implemented retry from Polly because I would…
Michael Bedford
  • 1,742
  • 20
  • 48
4
votes
2 answers

HttpClient Polly WaitAndRetry policy

Anyone have any idea on why the policy below stop retry after 3 times instead of 10 ? IAsyncPolicy httpWaitAndRetryPolicy = Policy.HandleResult(r => !r.IsSuccessStatusCode) …
cscmh99
  • 2,701
  • 2
  • 15
  • 18
4
votes
0 answers

Retries in AWS SDK

This doc indicates that using the aws sdk gives you out-of-the-box retry functionality. Then this doc states // The maximum number of times that a request will be retried for failures. // Defaults to -1, which defers the max retry setting to the…
Isaac Kleinman
  • 3,994
  • 3
  • 31
  • 35
4
votes
1 answer

Resilience4j Retry+Spring Boot 2 application.yml config not applied

I'm using Resilience4j @Retry combined with @CircuitBreaker. I use annotations in SpringBoot 2 and my configuration is in application.yml. I have a fallback method in the @Retry annotation, but not in the @CircuitBreaker (That's the way to make…
Stadmina
  • 121
  • 1
  • 8
4
votes
2 answers

Unit test HttpClient with Polly

I'm looking to unit test a HttpClient that has a Polly RetryPolicy and I'm trying to work out how to control what the HTTP response will be. I have used a HttpMessageHandler on the client and then override the Send Async and this works great but…
4
votes
0 answers

Kafka Producer Retry attempts

I'm a beginner in KAFKA. I was assigned a simple task to enable the producer to retry upon send failure. We have already added a kafka producer callback for this send() method, that just logs the response(before introducing retries). My objective:…
Yamuna
  • 41
  • 2
4
votes
2 answers

How to set Polly Retry for the set specific StatusCodes only

I have a couple of questions around similar concern: I'm making a call to EmailServer and using Polly Policy to WaitAndRetry. But I would like the Retry to happen only for specific timeouts: 5xx and 429 (and ignore the rest of the 4xx). How to make…
KVN
  • 863
  • 1
  • 17
  • 35
4
votes
2 answers

Scala retry sequence of futures until they all complete

In scala, how would you write a function that takes a Sequence of Futures, runs them all, continually retries any that fail, and returns the results? For example, the signature might be: def waitRetryAll[T](futures: Seq[Future[T]]):…
Jethro
  • 3,029
  • 3
  • 27
  • 56
4
votes
2 answers

Polly WaitAndRetryAsync hangs after one retry

I'm using Polly in very basic scenario to do exponential backoff if an HTTP call fails: protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { return await…
Tudor
  • 61,523
  • 12
  • 102
  • 142
4
votes
1 answer

How to do a `getOrWaitUntilNonEmpty` as a single liner?

I have a high-level code structure that looks like this: val block: (=> Option[Seq[String]]) = ... val matches = block().get.toArray The problem is that this code may fail i.e. .get being None depending on the time e.g. I'm page-scraping Google too…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
4
votes
2 answers

How does the retry statement work in Ruby?

I'm just getting started in Ruby, but the manual I'm following seems to be outdated. I've been doing some research but I've been unable to find a clear answer. The manual used the 'retry' keyword inside of a method that should act as a loop, but it…
Inot
  • 103
  • 2
  • 8
4
votes
3 answers

How Setup Parameters for AddHttpClient when IHttpClientFactory is created?

I'm try setting up a IHttpClientFactory, and i'd like to know how to send it parameters when it is created, those parameters i need to assign to retry policy. I'm using .Net Core 2.2 and Microsoft.Extensions.Http.Polly, I've read this post I have…
M. Mis
  • 107
  • 1
  • 1
  • 7
4
votes
1 answer

Reusing HttpRequestMessage in Polly retry policies

An HttpRequestMessage object can only be used one time; future attempts to use the same object throw an exception. I'm using Polly to retry some requests and I'm hitting this issue. I know how I can clone a request, there are plenty of examples on…
vaindil
  • 7,536
  • 21
  • 68
  • 127
3
votes
1 answer

Identify which GRPC service subscribed is down .NET 7

I have this implementation for subscribing the GRPC stream services, but, I have to identify when one of the services goes off and calls the event to notify the UI. public async Task Subscribe() { await Policy .Handle(e…
3
votes
2 answers

How to implement retry mechanism with exception and try catch

What I want to do: I want to implement a retry mechanism for function dailyComputeValue. dailyComputeValue will call computeValue. There is one part within function ComputeValue where we will call externalService.getRecord, which could return an…
1 2
3
25 26