Programming techniques designed to retry operations that failed due to error codes, exceptions, or other language specific means.
Questions tagged [retry-logic]
377 questions
1
vote
1 answer
Polly WaitAndRetryAsync vs WaitAndRetry
I am working on a retry logic in a .NET Core WebAPI project. I'm using there polly where we have WaitAndRetryAsync, WaitAndRetry methods.
What is the difference between WaitAndRetryAsync vs WaitAndRetry?
And which one should be used when?

itaustralia
- 127
- 1
- 12
1
vote
1 answer
Polly.Contrib.WaitAndRetry to "funnel" all requests when hitting rate limit
We're using the Dropbox API wrapped in Polly to handle retries.
We have it set up as an exponential back-off, like explained here.
The issue we have is that we make plenty of concurrent calls.
When the API starts throwing rate limit exceptions, each…

R4cOOn
- 2,340
- 2
- 30
- 41
1
vote
1 answer
Combining Polly policies and accessing handled exception in Polly policy Fallback
Given the following F# snippets
//User Code
.. code that can throw exceptions
"Success"
P1 policy
Policy
.Handle(fun cx -> cx.StatusCode = HttpStatusCode.TooManyRequests)
.WaitAndRetryForever((fun _ cx _ -> (cx :?>…

Franco Tiveron
- 2,364
- 18
- 34
1
vote
0 answers
Retry module interfering with 429 Retry-After logic
import json
from pprint import pprint
from requests.adapters import HTTPAdapter, Retry
from csv import writer
import pandas as pd
from time import sleep
def make_request():
fixed_api_key= '(insert api-key here)'
owner='problematic'
…

sutbly
- 11
- 2
1
vote
0 answers
Spring Retry using .retryOn and .notRetryOn
I am trying to execute the spring retry functionality in a certain code base using the imperative style. I want to retry only on RuntimeException, but not on NullPointerException. NullPointerException is a subclass of RuntimeException, hence I will…

greekgeek
- 11
- 3
1
vote
1 answer
Vertx amqp client doesnt reconnect on broker down
I am trying to write a program to pull messages from a message broker via Vert.x AMQP client. I want to make the program try to reconnect on broker down. Currently if I turn off the broker container, the program doesn't react. Below is my code..…

super_mario981
- 51
- 1
- 4
1
vote
2 answers
RabbitMQ message still retries after throwing AmqpRejectAndDontRequeueException
I have a simple Spring Boot application where I have the following settings for RabbitMQ (spring-boot-starter-amqp version is 2.7.0):
spring:
rabbitmq:
host: localhost
port: 5672
virtual-host: my_host
username: admin
password:…

victorio
- 6,224
- 24
- 77
- 113
1
vote
1 answer
Restsharp polly retry policy based on status
I am trying to manipulate polly retry policy based on response status code.
If status code is 500, I need to retry after 3 minutes else I need to retry after 2, 4 seconds.
I have something like this right now,
.OrResult(
(response)…

user1094183
- 181
- 1
- 3
- 12
1
vote
1 answer
Adjusting code to use the built-in RateLimit policy
I want to achieve the same behavior as the policy below with the built-in RateLimit policy, i.e. the logger message and to read the Retry-After header and wait the exact seconds that were needed to wait for but using the built-in RateLimit…

nop
- 4,711
- 6
- 32
- 93
1
vote
1 answer
TestNG doesn't re-run all failed methods after ElementClickInterceptedException
I have an automation framework TestNG + Selenide which runs jobs on Jenkins and provides Allure reports.
I've added a test class with some simple tests. One test occasionally fails when trying to click an element, but rerunning fixes the problem, so…

braveleg
- 125
- 1
- 2
- 9
1
vote
1 answer
Polly with IDistributedCache and IHttpClientFactory Policy
Using the following code compiles fine, but receives the runtime error below. Seems to be a conflict between the policy only supporting HttpResponseMessage when using IHttpClientFactory?
The end goal is to be able to use several policies like…

O.O
- 11,077
- 18
- 94
- 182
1
vote
1 answer
IHttpClient Polly Timeout and WaitAndRetry policy when handling concurrent http requests Clarification
Just have a question about Pollys timeout/retry policy and how it works when handling concurrent http requests.
From reading/my own understanding the timeout and retry policy will be applied to each individual http request, so if we have 5 http…

Adam
- 97
- 1
- 6
1
vote
1 answer
How to throw final error using WaitAndRetry and Execute?
I'm, trying to check a simple WaitAndRetry of Polly
class Program
{
public static void Main()
{
int i = 0;
var _retryPolicy = Policy
.Handle()
…

K.W
- 123
- 7
1
vote
1 answer
Implementing retry logic in node-fetch api call
I hope you will forgive the beginners question, I'm trying to implement a simple retry policy for an api call using node-fetch
This is being added to an existing repo using TypeScript so I'm using this also, hence the data definitions.
async…

Steerpike
- 1,712
- 6
- 38
- 71
1
vote
1 answer
Using Polly to do reconnects and timeouts
I'm having a problem using Polly while trying to accomplish the following:
Reconnect logic - I tried to create a Polly policy which works when you try to execute StartAsync without Internet connection. However, when it reaches ReceiveLoop, the…

nop
- 4,711
- 6
- 32
- 93