mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 11:28:22 +00:00
AmberRelayStats.addSent/addFailed called notify(id=2) synchronously for every relay event, driven by NostrClientLoggerListener.onSent. Bursts of relay traffic (7-34 notifies/sec vs Android's ~5/sec per-app limit) made NotificationManagerService shed the updates, freezing the status notification on stale text, and wasted a full BigTextStyle build plus Binder IPC per dropped event. Route the counter path through a Unit event flow (MutableSharedFlow, capacity 1, DROP_OLDEST) collected with debounce(300): a burst collapses into one notification update and the last tick always renders. No numeric counter, so nothing overflows or wraps no matter how long the process runs; tryEmit never suspends or fails on Quartz IO threads. Connection-state updates keep their existing debounce so connect/disconnect still shows promptly. Fixes ngit issue nevent1qy28wumn8ghj7un9d3shjtnwva5hgtnyv4mqqg80gw6ushd8jyj6rt8qseup7hngj0xhqa2ms3dvam60lhc760zvkyq6uts9