1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 06:11:19 +00:00

Speed up syncthing startup and reduce log spam (#60)

This commit is contained in:
Catfriend1 2018-09-15 22:26:16 +02:00 committed by Audrius Butkevicius
parent f915331114
commit ecd44b231f

View file

@ -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);
}