Procházet zdrojové kódy

routes: Values defined in the route should have precedence over values defined in CELERY_QUEUES.

This was not true, but the other way around instead.

If you had the following config:

CELERY_QUEUES = {"cpu-bound": {"routing_key": "tasks.cpu",
                               "exchange": "cpu-bound"}}

CELERY_ROUTES = {"tasks.add": {"routing_key": "tasks.cpu.add"}}

In this case the final routing key would be "tasks.cpu".
With this change the values in the route will be more important when the
values are merged, so the final options will become:

{"routing_key": "tasks.cpu.add",
 "exchange": "cpu-bound"}

Closes #177. Thanks to molotov.
Ask Solem před 14 roky
rodič
revize
d524e95078
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      celery/routes.py

+ 1 - 1
celery/routes.py

@@ -64,7 +64,7 @@ class Router(object):
                     raise QueueNotFound(
                         "Queue '%s' is not defined in CELERY_QUEUES" % queue)
             dest.setdefault("routing_key", dest.get("binding_key"))
-            return dict(route, **dest)
+            return dict(dest, **route)
 
         return route