Skip to content

Commit

Permalink
fix: disable connection retry for PUT and POST methods (minio#928)
Browse files Browse the repository at this point in the history
Fixes minio#924
  • Loading branch information
balamurugana authored May 19, 2020
1 parent dc9306b commit 9b85295
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/src/main/java/io/minio/MinioClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,14 @@ private Response execute(
}
}

Response response = this.httpClient.newCall(request).execute();
OkHttpClient httpClient = this.httpClient;
if (method == Method.PUT || method == Method.POST) {
// Issue #924: disable connection retry for PUT and POST methods. Its safe to do
// retry for other methods.
httpClient = this.httpClient.newBuilder().retryOnConnectionFailure(false).build();
}

Response response = httpClient.newCall(request).execute();
if (this.traceStream != null) {
this.traceStream.println(
response.protocol().toString().toUpperCase(Locale.US) + " " + response.code());
Expand Down

0 comments on commit 9b85295

Please sign in to comment.