소스 검색

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

Ask Solem 14 년 전
부모
커밋
6ae4ec75f3
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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.