mirror of
https://github.com/run-llama/llamaindex_aws_ingestion.git
synced 2026-07-01 21:34:01 -04:00
make worker more robust
This commit is contained in:
+11
-6
@@ -34,9 +34,6 @@ def worker_thread():
|
||||
port=5672,
|
||||
credentials=credentials
|
||||
)
|
||||
connection = pika.BlockingConnection(parameters=parameters)
|
||||
channel = connection.channel()
|
||||
channel.queue_declare(queue='etl')
|
||||
|
||||
def callback(ch, method, properties, body):
|
||||
try:
|
||||
@@ -69,9 +66,17 @@ def worker_thread():
|
||||
except Exception as e:
|
||||
print("Error during ingestion pipeline: ", e)
|
||||
pass
|
||||
|
||||
channel.basic_consume(queue='etl', on_message_callback=callback, auto_ack=True)
|
||||
channel.start_consuming()
|
||||
|
||||
while True:
|
||||
try:
|
||||
connection = pika.BlockingConnection(parameters=parameters)
|
||||
channel = connection.channel()
|
||||
channel.queue_declare(queue='etl')
|
||||
channel.basic_consume(queue='etl', on_message_callback=callback, auto_ack=True)
|
||||
channel.start_consuming()
|
||||
except Exception as e:
|
||||
print("Error rabbitMQ consuming: ", e)
|
||||
pass
|
||||
|
||||
|
||||
@app.get('/health')
|
||||
|
||||
Reference in New Issue
Block a user