Skip to content

Commit c5aeccf

Browse files
committed
Configurable retry on request failure
1 parent 7439b69 commit c5aeccf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/ConnectionContext.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,9 @@ public interface ConnectionContext {
5656
*/
5757
Mono<Void> trust(String host, int port);
5858

59+
/**
60+
* The number of retries after an unsuccessful request
61+
*/
62+
Long getInvalidTokenRetries();
63+
5964
}

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/util/Operator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ private Flux<HttpClientResponseWithBody> invalidateToken(Flux<HttpClientResponse
206206
private Flux<HttpClientResponseWithBody> processResponse(Flux<HttpClientResponseWithBody> inbound) {
207207
return inbound
208208
.transform(this::invalidateToken)
209-
.retry(t -> t instanceof InvalidTokenException)
209+
.retry(this.context.getConnectionContext().getInvalidTokenRetries(),
210+
t -> t instanceof InvalidTokenException)
210211
.transform(this.context.getErrorPayloadMapper()
211212
.orElse(ErrorPayloadMappers.fallback()));
212213
}

0 commit comments

Comments
 (0)