RetryInterceptor retries on SocketTimeoutException with no message (#4475)
This commit is contained in:
parent
f592bf54e4
commit
dbe9a8e0a5
|
|
@ -102,7 +102,9 @@ public final class RetryInterceptor implements Interceptor {
|
|||
return false;
|
||||
}
|
||||
String message = e.getMessage();
|
||||
return message != null && message.toLowerCase().contains("connect timed out");
|
||||
// Connect timeouts can produce SocketTimeoutExceptions with no message, or with "connect timed
|
||||
// out"
|
||||
return message == null || message.toLowerCase().contains("connect timed out");
|
||||
}
|
||||
|
||||
// Visible for testing
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class RetryInterceptorTest {
|
|||
// Shouldn't retry on write timeouts, where error message is "timeout", or other IOException
|
||||
assertThat(RetryInterceptor.isRetryableException(new SocketTimeoutException("timeout")))
|
||||
.isFalse();
|
||||
assertThat(RetryInterceptor.isRetryableException(new SocketTimeoutException())).isFalse();
|
||||
assertThat(RetryInterceptor.isRetryableException(new SocketTimeoutException())).isTrue();
|
||||
assertThat(RetryInterceptor.isRetryableException(new IOException("error"))).isFalse();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue