diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java index 99ed34c8..30de0a44 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java @@ -64,8 +64,8 @@ public class GetTask extends AsyncTask { fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); } - // Retry at most 10 times before failing - for (int i = 0; i < 10; i++) { + // Retry at most 5 times before failing + for (int i = 0; i < 5; i++) { HttpClient httpclient = Https.createHttpsClient(mHttpsCertPath); HttpGet get = new HttpGet(fullUri); get.addHeader(new BasicHeader(RestApi.HEADER_API_KEY, params[2])); @@ -91,7 +91,7 @@ public class GetTask extends AsyncTask { return result; } } catch (IOException|IllegalArgumentException e) { - Log.w(TAG, "Failed to call Rest API at " + fullUri, e); + Log.w(TAG, "Failed to call Rest API at " + fullUri); } try { // Don't push the API too hard @@ -99,7 +99,7 @@ public class GetTask extends AsyncTask { } catch (InterruptedException e) { Log.w(TAG, e); } - Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)"); + Log.w(TAG, "Retrying GetTask Rest API call (" + (i + 1) + "/5)"); } return null; } diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/PostScanTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/PostScanTask.java index bb161217..6e2e73c5 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/PostScanTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/PostScanTask.java @@ -48,8 +48,8 @@ public class PostScanTask extends AsyncTask { fullUri += "?" + URLEncodedUtils.format(urlParams, HTTP.UTF_8); Log.v(TAG, "Calling Rest API at " + fullUri); - // Retry at most 10 times before failing - for (int i = 0; i < 10; i++) { + // Retry at most 5 times before failing + for (int i = 0; i < 5; i++) { HttpClient httpclient = Https.createHttpsClient(mHttpsCertPath); HttpPost post = new HttpPost(fullUri); post.addHeader(new BasicHeader(RestApi.HEADER_API_KEY, params[1])); @@ -62,7 +62,7 @@ public class PostScanTask extends AsyncTask { if (response.getEntity() != null) return null; } catch (IOException | IllegalArgumentException e) { - Log.w(TAG, "Failed to call Rest API at " + fullUri, e); + Log.w(TAG, "Failed to call Rest API at " + fullUri); } try { // Don't push the API too hard @@ -70,7 +70,7 @@ public class PostScanTask extends AsyncTask { } catch (InterruptedException e) { Log.w(TAG, e); } - Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)"); + Log.w(TAG, "Retrying GetTask Rest API call (" + (i + 1) + "/5)"); } return null; }