File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -250,10 +250,14 @@ async def listen_for_messages():
250250 await queue .bind (exchange )
251251 await queue .bind (exchange , routing_key = "file_indexed_events" ) # Add this line
252252
253-
254253 logger .info (f" [*] Listening to { exchange } " )
254+
255+ # Create a partial function that includes the dependencies
256+ from functools import partial
257+ callback_with_deps = partial (callback , es = es , rabbitmq_client = channel )
258+
255259 await queue .consume (
256- callback = callback ,
260+ callback = callback_with_deps ,
257261 no_ack = False ,
258262 )
259263
@@ -263,6 +267,7 @@ async def listen_for_messages():
263267 await asyncio .Future ()
264268 finally :
265269 await connection .close ()
270+ await es .close () # Close ES connection when done
266271
267272
268273if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments