소스 검색

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