1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Filter unreasonable quotas

This commit is contained in:
M66B 2024-05-06 16:50:44 +02:00
parent f3e586b112
commit 2154dd261e

View file

@ -156,6 +156,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private static final int FAST_FAIL_COUNT = 3;
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 String ACTION_NEW_MESSAGE_COUNT = BuildConfig.APPLICATION_ID + ".NEW_MESSAGE_COUNT";
@ -2919,9 +2920,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
" " + resource.usage + "/" + resource.limit);
// (STORAGE nnnnn 9999999999999999)
if ("STORAGE".equalsIgnoreCase(resource.name)) {
if (resource.usage * 1024 >= 0)
if (resource.usage * 1024 >= 0 && resource.usage < MAX_QUOTA)
usage = (usage == null ? 0L : usage) + resource.usage * 1024;
if (resource.limit * 1024 > 0)
if (resource.limit * 1024 > 0 && resource.limit < MAX_QUOTA)
limit = Math.max(limit == null ? 0L : limit, resource.limit * 1024);
}
}