From d76db13b54f6525737647490813f1673ac3c2967 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 30 Nov 2024 07:41:47 +0100 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 4595caf58d..b7809ccaf0 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -160,6 +160,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences private static final int FETCH_YIELD_DURATION = 50; // milliseconds private static final long WATCHDOG_INTERVAL = 60 * 60 * 1000L; // milliseconds private static final long MAX_QUOTA = 1000 * 1000 * 1000L; // KB + private static final int YAHOO_RESTART_INTERVAL = 120; // seconds private static final String ACTION_NEW_MESSAGE_COUNT = BuildConfig.APPLICATION_ID + ".NEW_MESSAGE_COUNT"; @@ -1671,8 +1672,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (account.keep_alive_noop) { int timeout = prefs.getInt("timeout", EmailService.DEFAULT_CONNECT_TIMEOUT); - if (account.isYahoo() && timeout < 60) { - int factor = 60 / timeout; + if (account.isYahoo() && timeout < YAHOO_RESTART_INTERVAL) { + int factor = YAHOO_RESTART_INTERVAL / timeout; iservice.setRestartIdleInterval(timeout * factor); } else iservice.setRestartIdleInterval(timeout * 2 * 6); // 20 x 2 x 6 = 4 min