Pārlūkot izejas kodu

Consumer: Adds a timeout when draining_events. The idea is that this may ensure the recv call is not stuck

Ask Solem 14 gadi atpakaļ
vecāks
revīzija
6ae4ec75f3
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      celery/worker/consumer.py

+ 4 - 1
celery/worker/consumer.py

@@ -288,7 +288,10 @@ class Consumer(object):
                 break
             if self.qos.prev != self.qos.value:
                 self.qos.update()
-            self.connection.drain_events()
+            try:
+                self.connection.drain_events(timeout=1)
+            except socket.timeout:
+                pass
 
     def on_task(self, task):
         """Handle received task.