瀏覽代碼

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 14 年之前
父節點
當前提交
d524e95078
共有 1 個文件被更改,包括 1 次插入1 次删除
  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