@@ -17,10 +17,11 @@ class InternalConsumer:
1717 consumption by the transport
1818 """
1919
20- def __init__ (self , queue : InternalQueue , error_queue : ErrorQueueType ):
20+ def __init__ (self , name : str , queue : InternalQueue , error_queue : ErrorQueueType ):
2121 self ._consumer_task : Optional [asyncio .Task ] = None
2222 self ._running_commands = set ()
2323 self ._ready = asyncio .Event ()
24+ self .name = name
2425 self .queue = queue
2526 self .error_queue = error_queue
2627
@@ -30,7 +31,7 @@ def start(self, handler: Callable):
3031 Use `stop()` to shutdown the invoker.
3132 """
3233 logger .debug (
33- f"Starting consumer for handler { handler .__qualname__ } (). This should report ready"
34+ f"Starting { self . name } consumer for handler { handler .__qualname__ } (). This should report ready"
3435 " shortly..."
3536 )
3637 self ._consumer_task = asyncio .ensure_future (
@@ -58,7 +59,9 @@ async def close(self):
5859
5960 async def _consumer_loop (self , queue , handler ):
6061 """Continually fetch commands from the queue and handle them"""
61- logger .debug (f"Consumer loop is ready with handler { handler .__qualname__ } ()" )
62+ logger .debug (
63+ f"Consumer loop for { self .name } is ready with handler { handler .__qualname__ } ()"
64+ )
6265 self ._ready .set ()
6366
6467 while True :
@@ -75,7 +78,7 @@ def handle_in_background(self, queue: InternalQueue, handler, command, on_done:
7578
7679 This execution happens in the background.
7780 """
78- logger .debug (f"Handling command { command } " )
81+ logger .debug (f"Handling command { command } in consumer { self . name } " )
7982
8083 def when_task_finished (fut : asyncio .Future ):
8184 self ._running_commands .remove (fut )
0 commit comments