From 1cb60aede4cc1b73c25e14410d2aae1d821e8b53 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 27 Oct 2020 15:53:02 +0100 Subject: [PATCH] added connection timeout and socket timeout 600 sec --- .../java/eu/dnetlib/dhp/common/api/ZenodoAPIClient.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/common/api/ZenodoAPIClient.java b/dhp-common/src/main/java/eu/dnetlib/dhp/common/api/ZenodoAPIClient.java index f2dd4f0ac..d66290a76 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/common/api/ZenodoAPIClient.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/common/api/ZenodoAPIClient.java @@ -3,6 +3,7 @@ package eu.dnetlib.dhp.common.api; import java.io.*; import java.io.IOException; +import java.util.concurrent.TimeUnit; import com.google.gson.Gson; @@ -92,7 +93,11 @@ public class ZenodoAPIClient implements Serializable { * @return the response code */ public int uploadIS(InputStream is, String file_name, long len) throws IOException { - OkHttpClient httpClient = new OkHttpClient(); + OkHttpClient httpClient = new OkHttpClient + .Builder() + .connectTimeout(600, TimeUnit.SECONDS) + .readTimeout(600, TimeUnit.SECONDS) + .writeTimeout(600, TimeUnit.SECONDS).build(); Request request = new Request.Builder() .url(bucket + "/" + file_name)