Jelajahi Sumber

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 tahun lalu
induk
melakukan
c30bebe09d
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  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()