Skip to content

Commit

Permalink
fix(cf): Exponentially backoff when Cloud Foundry is unavailable (#3725)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Schneider committed May 29, 2019
1 parent 45e5a42 commit 1517a50
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Response;
import io.github.resilience4j.retry.IntervalFunction;
import io.github.resilience4j.retry.Retry;
import io.github.resilience4j.retry.RetryConfig;
import java.net.SocketTimeoutException;
Expand Down Expand Up @@ -90,7 +91,11 @@ Response createRetryInterceptor(Interceptor.Chain chain) {
final String callName = "cf.api.call";
Retry retry =
Retry.of(
callName, RetryConfig.custom().retryExceptions(RetryableApiException.class).build());
callName,
RetryConfig.custom()
.intervalFunction(IntervalFunction.ofExponentialBackoff(Duration.ofSeconds(10), 3))
.retryExceptions(RetryableApiException.class)
.build());

AtomicReference<Response> lastResponse = new AtomicReference<>();
try {
Expand Down

0 comments on commit 1517a50

Please sign in to comment.