Преглед на файлове

Transport can now decide which event loop to use

Ask Solem преди 9 години
родител
ревизия
70cfaecae4
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      celery/worker/components.py

+ 2 - 2
celery/worker/components.py

@@ -73,9 +73,9 @@ class Hub(bootsteps.StartStopStep):
     def create(self, w):
         w.hub = get_event_loop()
         if w.hub is None:
+            required_hub = getattr(w._conninfo, 'requires_hub', None)
             w.hub = set_event_loop((
-                w._conninfo.requires_hub
-                    if w._conninfo.requires_hub else _Hub)(w.timer))
+                required_hub if required_hub else _Hub)(w.timer))
         self._patch_thread_primitives(w)
         return self