Explorar o código

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 %!s(int64=14) %!d(string=hai) anos
pai
achega
d524e95078
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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