refactor(broker): make tasks queue a member of the broker instance

This enables implementing non-standard routing behavior from
custom classes inheriting from Broker()
pull/209/head
Luis Linares 2025-01-03 15:46:35 +01:00 zatwierdzone przez Florian Ludwig
rodzic 186c51014e
commit 440e8ff945
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -187,6 +187,8 @@ class Broker:
self._broadcast_task = None
self._broadcast_shutdown_waiter = futures.Future()
self._tasks_queue = deque()
# Init plugins manager
context = BrokerContext(self)
context.config = self.config
@ -881,7 +883,7 @@ class Broker:
return match_pattern.fullmatch(topic)
async def _broadcast_loop(self):
running_tasks = deque()
running_tasks = self._tasks_queue
try:
while True:
while running_tasks and running_tasks[0].done():