Przeglądaj źródła

Disable events completely if without-gossip+without-heartbeat. Closes #2483

Ask Solem 9 lat temu
rodzic
commit
c136e7f0cb
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7 2
      celery/worker/consumer.py

+ 7 - 2
celery/worker/consumer.py

@@ -542,9 +542,14 @@ class Connection(bootsteps.StartStopStep):
 class Events(bootsteps.StartStopStep):
     requires = (Connection,)
 
-    def __init__(self, c, send_events=None, **kwargs):
-        self.send_events = True
+    def __init__(self, c, send_events=True,
+                 without_heartbeat=False, without_gossip=False, **kwargs):
         self.groups = None if send_events else ['worker']
+        self.send_events = (
+            send_events or
+            not without_gossip or
+            not without_heartbeat
+        )
         c.event_dispatcher = None
 
     def start(self, c):