diff --git a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageRetryHandler.java b/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageRetryHandler.java index c0b78172c112..bfa67a096031 100644 --- a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageRetryHandler.java +++ b/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageRetryHandler.java @@ -144,7 +144,7 @@ void sleepForAttempt(int attempt) { * @return true if exs is a retryable error, otherwise false */ private static boolean isRetryable(final StorageException exs) { - return exs.isRetryable() || exs.getCode() == 500 || exs.getCode() == 503; + return exs.isRetryable() || exs.getCode() == 500 || exs.getCode() == 502 || exs.getCode() == 503; } /** @@ -154,7 +154,7 @@ private static boolean isRetryable(final StorageException exs) { private static boolean isReopenable(final StorageException exs) { Throwable throwable = exs; // ensures finite iteration - int maxDepth = 10; + int maxDepth = 20; while (throwable != null && maxDepth-- > 0) { if ((throwable.getMessage() != null && throwable.getMessage().contains("Connection closed prematurely"))