mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Investigating why backgrounding the app on the all-follows feed leaves ~172 outbox relays connected when only inbox + DM relays (~8) should remain. The static teardown chain (lifecycle ON_STOP -> unsubscribe -> client.unsubscribe -> PoolRequests.remove -> RelayPool.updatePool disconnect) is correct, so this adds runtime tracing at the two decisive hops to find where it stalls on-device: - LifecycleAwareKeyDataSourceSubscription: log subscribe/grace-start/ unsubscribe/dispose with the assembler name (tag BgRelayTrace). - RelayPool.updatePool: log desired/inPool/toRemove/connected counts. Also drops UNSUBSCRIBE_GRACE_MILLIS 30s -> 0 as an experiment: if the grace delay() was being starved on Dispatchers.Default once backgrounded (Doze/app-standby suspends timers), unsubscribing immediately on ON_STOP both proves and fixes the leak. To be reverted to a wakelock-safe grace once confirmed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ukw6FJPFh3JKGXL532p3ae