mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 03:18:23 +00:00
The ConnectivityService safety-net tick woke the CPU every 30 seconds for the whole life of the process (~2,880 wakeups/day) even though every real state change already refreshes the subscriptions explicitly and Quartz replays subscriptions on reconnect. Raise the tick to 5 minutes; it now only covers genuinely missed paths. Bound the built-in Tor startup: when Tor cannot bootstrap (airplane mode, censored network), runMigrations previously stop/start cycled the whole daemon every ~2 minutes forever, burning battery and data until the network came back. After 5 attempts (120s bootstrap window each, backoff 3/6/12/24s) the daemon is stopped, a non-ongoing Failed notification with the Restart action is shown, and relay connections stay down instead of failing endlessly through a dead SOCKS proxy. Relay connections now recover automatically when Tor comes back: a new rising-edge observer on TorManager.isRunning refreshes subscriptions (covers manual restarts mid-session, which previously left relays disconnected), and a network change retries Tor when it had given up.