From 3eab8fe1328d72964498568a73cdec6fc52ed48c Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Sat, 15 Sep 2018 22:26:16 +0200 Subject: [PATCH] Speed up syncthing startup and reduce log spam (#60) --- .../syncthingandroid/http/PollWebGuiAvailableTask.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java b/app/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java index 554007f1..6c0ffc68 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java @@ -29,6 +29,8 @@ public class PollWebGuiAvailableTask extends ApiRequest { private OnSuccessListener mListener; + private Integer logIncidence = 0; + /** * Object that must be locked upon accessing mListener */ @@ -74,7 +76,11 @@ public class PollWebGuiAvailableTask extends ApiRequest { mHandler.postDelayed(this::performRequest, WEB_GUI_POLL_INTERVAL); Throwable cause = error.getCause(); if (cause == null || cause.getClass().equals(ConnectException.class)) { - Log.v(TAG, "Polling web gui"); + // Reduce lag caused by massively logging the same line while waiting. + logIncidence++; + if (logIncidence == 1 || logIncidence % 10 == 0) { + Log.v(TAG, "Polling web gui ... (" + logIncidence + ")"); + } } else { Log.w(TAG, "Unexpected error while polling web gui", error); }