Questions tagged [retrywhen]

59 questions
12
votes
1 answer

Spring WebClient - how to retry with delay based on response header

A little background I've been learning Spring Webflux and reactive programming and have gotten stuck on a problem I'm trying to solve around retry logic using Spring Webclient. I've created a client and made successful calls to an external…
7
votes
1 answer

Angular 7 - How to retry an http request on certain response status codes?

I'm trying to catch http request's errors from an Angular interceptor and handle 401 as logout while retrying a 503 and 504 responses n times. This is my http interceptor: intercept(req: HttpRequest, next: HttpHandler):…
AleG
  • 111
  • 2
  • 5
7
votes
2 answers

Retry a call with Retrofit 2 and RxJava2 after displaying a dialog

I'm calling an API using Retrofit 2 and RxJava2. If a call fails, in some cases (e.g. no Internet connection), I want to display an error dialog to the user and let him retry. As I'm using RxJava, I was thinking of using .retryWhen(...) but I don't…
Eselfar
  • 3,759
  • 3
  • 23
  • 43
5
votes
1 answer

Unit testing retry in Spring Webflux with mocked response

During unit testing retry the response of the mock seems cached, or most probably I am doing something wrong. I am trying to request something, if error happened then retry twice with delay of 1 second. public Mono someMethod(String…
Hatik
  • 1,139
  • 1
  • 15
  • 33
4
votes
2 answers

How to retry when the API calls fails after subscribing in Angular 2+

I am calling an API to get random details. The problem is that, sometimes I am getting 502 error as bad gateway and it may also break due to a bad network connection also. Below is my code to API call // COMPONENT API CALL SUBSCRIBE …
Onera
  • 687
  • 3
  • 14
  • 34
3
votes
1 answer

Angular unit test - testing retryWhen in HttpInterceptor

I'm trying to test a retryWhen operator in an http interceptor but I'm getting an error when trying to repeat my service call multiple times: "Error: Expected one matching request for criteria "Match URL: http://someurl/tesdata", found none." So I…
BWG
  • 304
  • 3
  • 15
3
votes
3 answers

How can I unit test a retryWhen operator in rxjs?

I am attempting to unit test a custom RxJS operator. The operator is very simple, it uses RetryWhen to retry a failed HTTP request, but has a delay and will only retry when the HTTP Error is in the 500 range. Using jasmine, and this is in an Angular…
Brian
  • 77
  • 1
  • 6
3
votes
1 answer

RXJS: adaptative timeout

I am using RXJS 6 and i trying to do a retry with adaptative timeout (i try first time with 1s timeout, if not successful i retry but with 2s timeout, etc...) It look like the timeout value is not updated on retry, i am newbie on RxJS on i cannot…
Mr2dishes
  • 407
  • 1
  • 6
  • 17
3
votes
1 answer

Angular 5.2 & RxJS 5.5 HttpInterceptor retryWhen, but update request?

I am trying to intercept a 401 response, send a refresh token request before trying request again (but with a different header). I have it working except retryWhen does not give me to modify the original request header. So I've been trying to use…
Joseph Montanez
  • 1,598
  • 1
  • 17
  • 31
3
votes
2 answers

Throw error after the retry fails with Angular http.get

I'm trying to implement Angular5 http.get with retry. I wrote http.get('/api/study').retryWhen( (errors: Observable):Observable => { return errors.flatMap((error: any) => { if (error.status == 500) { …
John Henckel
  • 10,274
  • 3
  • 79
  • 79
2
votes
1 answer

How to conditionally do retryWhen on action click from snackbar action Angular 7.x

I'm developing a retry functionality automatically by a ErrorInterceptor implementing HttpInterceptor. I read that the retryWhen is exactly what I need. What I want it to happen is conditionally retry on the clicking of the Snackbar 'RETRY' button…
2
votes
1 answer

set delay dynamic on retryWhen

Is it possible to set the delay value dynamic after every retry. I tried it like this but it looks lite it keeps the value which is set initial. imageController(epgData: EpgDataDTO[], showOrMovie: string){ var retryAfterMilliSeconds = 1000; …
WeSt
  • 889
  • 5
  • 14
  • 32
2
votes
1 answer

RxJS Observable: retry using count and then using notifier

Firstly, I'd like to retry using a simple count: Retry the source observable n times. Then, emit the error. (Preferably, the error may be emitted immediately after each retry, but retry(count) does not seem to do this.) If I understand correctly,…
Oliver Joseph Ash
  • 3,138
  • 2
  • 27
  • 47
2
votes
1 answer

Retrying a http call on receiving a certain http status

I'm trying to catch and retry a 103 Http error status response. The service call returns 103 if the server understood the request and will start processing it but resource is immediately unavailable. What I'd like to do is when I receive 103, I'd…
Anjil Dhamala
  • 1,544
  • 3
  • 18
  • 37
2
votes
3 answers

RxJava 2. Retry with delay while proceeding other items that are distinct

I have an observable that gets items from a lot of sources: Source { List data } Relationship between sources and items is many-to-many and in different sources items could duplicate themselves. Item is an entity that should be uploaded to…
Olexii Muraviov
  • 1,456
  • 1
  • 12
  • 36
1
2 3 4