Преглед изворни кода

Sleep only 0.2s not 1s after empty queue (round-trip time went from 0.03s to 0.01s, without hammering CPU)

Ask Solem пре 15 година
родитељ
комит
c30bebe09d
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      celery/worker/controllers.py

+ 1 - 1
celery/worker/controllers.py

@@ -88,7 +88,7 @@ class Mediator(BackgroundThread):
             # This blocks until there's a message in the queue.
             task = self.ready_queue.get(timeout=1)
         except QueueEmpty:
-            time.sleep(1)
+            time.sleep(0.2)
         else:
             if task.task_id in revoked: # task revoked
                 task.on_ack()