Skip to content

Commit

Permalink
Added check to ensure the connection is established.
Browse files Browse the repository at this point in the history
  • Loading branch information
SOSNE committed Jul 22, 2024
1 parent fd98003 commit 05475e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions workers/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def start_summarizer():
connection = pika.BlockingConnection(connection_params)
channel = connection.channel()
while True:
if connection.is_open is False:
connection_params = pika.ConnectionParameters(host="rabbitmq", port=5672, heartbeat=600)
connection = pika.BlockingConnection(connection_params)
channel = connection.channel()

queue_length = len(task_queue)
if queue_length > previous_queued_tasks:
print(f"{Fore.CYAN}{Style.BRIGHT}--- SUMMARIZER ---")
Expand Down

0 comments on commit 05475e7

Please sign in to comment.