Properly handle a "primary" run_on value

This commit is contained in:
Joshua Boniface 2023-11-16 02:49:29 -05:00
parent e818df5dae
commit 289049d223
1 changed files with 2 additions and 0 deletions

View File

@ -89,6 +89,8 @@ def route_task(name, args, kwargs, options, task=None, **kw):
# If an explicit routing_key is set and it's in the kwargs of the function, use it to set the queue
if options["routing_key"] != "default" and options["routing_key"] in kwargs.keys():
run_on = kwargs[options["routing_key"]]
if run_on == "primary":
run_on = get_primary_node()
# Otherwise, use the primary node
else:
run_on = get_primary_node()