From 2c547ee1fc19ad5ac93744f39db3f48eb0780551 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Mon, 2 Mar 2026 07:48:08 +0100 Subject: [PATCH] fix(perf): disable auto_update_contacts to prevent serial blocking auto_update_contacts=True triggers ensure_contacts() on every ADVERTISEMENT event, fetching 324+ contacts over serial (several seconds). This blocks the serial port and delays MESSAGES_WAITING processing, causing 10-30s message reception delays. Contacts are synced at startup and updated individually via NEW_CONTACT events. Co-Authored-By: Claude Opus 4.6 --- app/device_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/device_manager.py b/app/device_manager.py index 56c8da4..af508dd 100644 --- a/app/device_manager.py +++ b/app/device_manager.py @@ -172,7 +172,10 @@ class DeviceManager: await self._subscribe_events() # Enable auto-refresh of contacts on adverts/path updates - self.mc.auto_update_contacts = True + # Keep auto_update_contacts OFF to avoid serial blocking on every + # ADVERTISEMENT event (324 contacts = several seconds of serial I/O). + # We sync contacts at startup and handle NEW_CONTACT events individually. + self.mc.auto_update_contacts = False # Fetch initial contacts from device await self.mc.ensure_contacts()