From 8a41129dfc68277deab8ed1da23b91b928bcc67c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 28 Jul 2026 18:57:30 +0000 Subject: [PATCH] fix(resource-usage): double the report-prompt trigger thresholds Raise every ResourceUsageAlerts threshold to 2x so the "this app is consuming too much" report prompt only fires at twice the previous consumption levels, cutting false positives on heavy-but-normal days: - background mobile data: 50 MB -> 100 MB / day - background mobile relay-connection time: 12 h -> 24 h / day - notification wakelock: 30 min -> 60 min / day - app process starts: 75 -> 150 / day - completed relay (re)connections: 5000 -> 10000 / day Tests reference the constants symbolically, so the alert suite stays green. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01R2efhyiQHKFoNjQo6WnGRH --- .../resourceusage/ResourceUsageAlerts.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageAlerts.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageAlerts.kt index b72cbdf173..7ebb8293cd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageAlerts.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageAlerts.kt @@ -46,25 +46,25 @@ object ResourceUsageAlerts { val value: Long, ) - /** > 50 MB of background traffic on cellular in one day. */ - const val BG_MOBILE_BYTES_PER_DAY = 50L * 1024L * 1024L + /** > 100 MB of background traffic on cellular in one day. */ + const val BG_MOBILE_BYTES_PER_DAY = 100L * 1024L * 1024L - /** > 12 relay-connection-hours while backgrounded on cellular in one day. */ - const val BG_MOBILE_RELAY_CONN_MS_PER_DAY = 12L * 60L * 60L * 1000L + /** > 24 relay-connection-hours while backgrounded on cellular in one day. */ + const val BG_MOBILE_RELAY_CONN_MS_PER_DAY = 24L * 60L * 60L * 1000L - /** > 30 minutes of notification wakelock held in one day. */ - const val WAKELOCK_MS_PER_DAY = 30L * 60L * 1000L + /** > 60 minutes of notification wakelock held in one day. */ + const val WAKELOCK_MS_PER_DAY = 60L * 60L * 1000L - /** > 75 process starts in one day (WorkManager/restart churn). */ - const val APP_STARTS_PER_DAY = 75L + /** > 150 process starts in one day (WorkManager/restart churn). */ + const val APP_STARTS_PER_DAY = 150L /** - * > 5000 completed relay (re)connections in one day. A healthy day is a + * > 10000 completed relay (re)connections in one day. A healthy day is a * few hundred to ~2000 even with a large relay set; sustained thousands * means something is cycling (a stuck relay tier, a flapping network, a * Tor bootstrap loop) and every cycle pays a TLS handshake. */ - const val RELAY_CONNECTS_PER_DAY = 5_000L + const val RELAY_CONNECTS_PER_DAY = 10_000L const val MIN_DAYS_BETWEEN_PROMPTS = 7L