From 70131914b2f22a51c26d09618e554fb8cc57087f Mon Sep 17 00:00:00 2001 From: catbref Date: Thu, 26 Mar 2020 12:44:47 +0000 Subject: [PATCH] Auto-updates: increase checking interval & TCP timeouts Bumped TCP timeouts for fetching auto-update from 5s (connect) and 3s (read) to 30s (connect) and 10s (read) to allow for nodes with slower internet connections. Increased interval between checking for auto-updates from 5 minutes to 20 minutes to reduce load on update sources and also to reduce the number of nodes that restart at any one time. Obviously this new checking interval will only apply after the NEXT auto-update... --- src/main/java/org/qortal/api/ApiRequest.java | 4 ++-- src/main/java/org/qortal/controller/AutoUpdate.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/qortal/api/ApiRequest.java b/src/main/java/org/qortal/api/ApiRequest.java index f5f5b4ce..5517ff53 100644 --- a/src/main/java/org/qortal/api/ApiRequest.java +++ b/src/main/java/org/qortal/api/ApiRequest.java @@ -149,8 +149,8 @@ public class ApiRequest { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); - con.setConnectTimeout(5000); - con.setReadTimeout(3000); + con.setConnectTimeout(30000); + con.setReadTimeout(10000); ApiRequest.setConnectionSSL(con, ipAddress); int status = con.getResponseCode(); diff --git a/src/main/java/org/qortal/controller/AutoUpdate.java b/src/main/java/org/qortal/controller/AutoUpdate.java index ff941fb3..61dcc46d 100644 --- a/src/main/java/org/qortal/controller/AutoUpdate.java +++ b/src/main/java/org/qortal/controller/AutoUpdate.java @@ -41,7 +41,7 @@ public class AutoUpdate extends Thread { public static final String NEW_JAR_FILENAME = "new-" + JAR_FILENAME; private static final Logger LOGGER = LogManager.getLogger(AutoUpdate.class); - private static final long CHECK_INTERVAL = 5 * 60 * 1000L; // ms + private static final long CHECK_INTERVAL = 20 * 60 * 1000L; // ms private static final int DEV_GROUP_ID = 1; private static final int UPDATE_SERVICE = 1; @@ -210,7 +210,7 @@ public class AutoUpdate extends Thread { return false; // failed - try another repo } } catch (IOException e) { - LOGGER.warn(String.format("Failed to fetch update from %s", repoUri)); + LOGGER.warn(String.format("Failed to fetch update from %s: %s", repoUri, e.getMessage())); return false; // failed - try another repo }