kopia lustrzana https://github.com/Yakifo/amqtt
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
rodzic
186c51014e
commit
440e8ff945
|
@ -187,6 +187,8 @@ class Broker:
|
||||||
self._broadcast_task = None
|
self._broadcast_task = None
|
||||||
self._broadcast_shutdown_waiter = futures.Future()
|
self._broadcast_shutdown_waiter = futures.Future()
|
||||||
|
|
||||||
|
self._tasks_queue = deque()
|
||||||
|
|
||||||
# Init plugins manager
|
# Init plugins manager
|
||||||
context = BrokerContext(self)
|
context = BrokerContext(self)
|
||||||
context.config = self.config
|
context.config = self.config
|
||||||
|
@ -881,7 +883,7 @@ class Broker:
|
||||||
return match_pattern.fullmatch(topic)
|
return match_pattern.fullmatch(topic)
|
||||||
|
|
||||||
async def _broadcast_loop(self):
|
async def _broadcast_loop(self):
|
||||||
running_tasks = deque()
|
running_tasks = self._tasks_queue
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
while running_tasks and running_tasks[0].done():
|
while running_tasks and running_tasks[0].done():
|
||||||
|
|
Ładowanie…
Reference in New Issue