Skip to content

Commit f84f225

Browse files
committed
need to test - adding dependencies needed
1 parent fb08a61 commit f84f225

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backend/message_listener.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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

268273
if __name__ == "__main__":

0 commit comments

Comments
 (0)