From e5644cc49d6323457cb53342f3068bdde797d206 Mon Sep 17 00:00:00 2001 From: Walter Boring Date: Fri, 9 Jan 2026 12:31:46 -0500 Subject: [PATCH] Remove plugin.run() locking The plugin doesn't really need locks when processing the packets as there is really only 1 thread that sends packets through the plugins processing. --- aprsd/plugin.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index c40dff3..897cffd 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -514,12 +514,17 @@ class PluginManager: def run(self, packet: packets.MessagePacket): """Execute all the plugins run method.""" - with self.lock: - return self._pluggy_pm.hook.filter(packet=packet) + # No lock needed here - plugins are loaded at startup and not modified + # during runtime in listen command. Pluggy's hook execution is thread-safe + # for read operations. This prevents lock contention when plugins are slow + # (e.g., MQTT publish queue full scenarios). + return self._pluggy_pm.hook.filter(packet=packet) def run_watchlist(self, packet: packets.Packet): - with self.lock: - return self._watchlist_pm.hook.filter(packet=packet) + # No lock needed here - plugins are loaded at startup and not modified + # during runtime in listen command. Pluggy's hook execution is thread-safe + # for read operations. + return self._watchlist_pm.hook.filter(packet=packet) def stop(self): """Stop all threads created by all plugins."""