Przeglądaj źródła

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 lat temu
rodzic
commit
c30bebe09d
1 zmienionych plików z 1 dodań i 1 usunięć
  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()