1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-02-14 20:13:46 -05:00

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.
This commit is contained in:
Walter Boring 2026-01-09 12:31:46 -05:00
parent 3198f06e2a
commit e5644cc49d

View File

@ -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."""