Update ack
Browse files
worker.py
CHANGED
|
@@ -74,6 +74,7 @@ class RabbitMQWorker:
|
|
| 74 |
|
| 75 |
try:
|
| 76 |
if headers.get("request_type") == "process_files":
|
|
|
|
| 77 |
contexts = []
|
| 78 |
body_dict = json.loads(body)
|
| 79 |
|
|
@@ -87,7 +88,7 @@ class RabbitMQWorker:
|
|
| 87 |
contexts.append({"key": file["key"], "body": f"Error: {str(e)}"})
|
| 88 |
|
| 89 |
body_dict["md_context"] = contexts
|
| 90 |
-
|
| 91 |
|
| 92 |
# Publish results
|
| 93 |
if self.publish_message(body_dict, headers):
|
|
@@ -98,7 +99,7 @@ class RabbitMQWorker:
|
|
| 98 |
|
| 99 |
print(f"[Worker {thread_id}] Contexts: {contexts}")
|
| 100 |
else:
|
| 101 |
-
ch.
|
| 102 |
print(f"[Worker {thread_id}] Unknown process")
|
| 103 |
|
| 104 |
except Exception as e:
|
|
|
|
| 74 |
|
| 75 |
try:
|
| 76 |
if headers.get("request_type") == "process_files":
|
| 77 |
+
ch.basic_ack(delivery_tag=method.delivery_tag)
|
| 78 |
contexts = []
|
| 79 |
body_dict = json.loads(body)
|
| 80 |
|
|
|
|
| 88 |
contexts.append({"key": file["key"], "body": f"Error: {str(e)}"})
|
| 89 |
|
| 90 |
body_dict["md_context"] = contexts
|
| 91 |
+
|
| 92 |
|
| 93 |
# Publish results
|
| 94 |
if self.publish_message(body_dict, headers):
|
|
|
|
| 99 |
|
| 100 |
print(f"[Worker {thread_id}] Contexts: {contexts}")
|
| 101 |
else:
|
| 102 |
+
ch.basic_ack(delivery_tag=method.delivery_tag)
|
| 103 |
print(f"[Worker {thread_id}] Unknown process")
|
| 104 |
|
| 105 |
except Exception as e:
|