Skip to content

Commit

Permalink
fix: enlarge presign timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Apr 9, 2024
1 parent 61c0364 commit 2f58779
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class DatabendPresignClientV1 implements DatabendPresignClient {

private static final int MaxRetryAttempts = 10;
private static final int MaxRetryAttempts = 20;

private static final Duration RetryTimeout = Duration.ofMinutes(5);
private final OkHttpClient client;
Expand All @@ -45,10 +45,7 @@ public DatabendPresignClientV1(OkHttpClient client, String uri) {
Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINEST);
OkHttpClient.Builder builder = client.newBuilder();
this.client = builder.
connectTimeout(120, TimeUnit.SECONDS)
.readTimeout(90, TimeUnit.SECONDS)
.callTimeout(90, TimeUnit.SECONDS)
.writeTimeout(90, TimeUnit.SECONDS).build();
connectTimeout(120, TimeUnit.SECONDS).build();
this.uri = uri;
}

Expand Down Expand Up @@ -103,7 +100,7 @@ private ResponseBody executeInternal(Request request, boolean shouldClose) throw
if (attempts > 0) {
logger.info("try to presign upload again: " + attempts);
Duration sinceStart = Duration.ofNanos(System.nanoTime() - start);
if (sinceStart.getSeconds() >= 600) {
if (sinceStart.getSeconds() >= 900) {
logger.warning("Presign upload failed, error is:" + cause.toString());
throw new RuntimeException(format("Error execute presign (attempts: %s, duration: %s)", attempts, sinceStart), cause);
}
Expand Down

0 comments on commit 2f58779

Please sign in to comment.