django-q2
django-q2 copied to clipboard
BUG: async_chain calls get_broker without the cluster argument
Broker is created without the cluster / list_key arg and passed down:
https://github.com/django-q2/django-q2/blob/efa0d6d9e4d9b6ea9d8d0af7cb82e8c0f856383e/django_q/tasks.py#L493-L494
Which is inconsistent with:
https://github.com/django-q2/django-q2/blob/efa0d6d9e4d9b6ea9d8d0af7cb82e8c0f856383e/django_q/tasks.py#L57
This causes a bug where the cluster
kwarg is not respected for async_chain. Reprod:
@pytest.mark.django_db
def test_chains_correct_cluster2():
"""Check that chains are correctly assigned to the correct cluster"""
dq.async_chain([("math.copysign", (x, y), {"cluster": "testy-test"}) for x, y in [(2, -2), (3, -3)]], sync=False)
# assertion error because cluster kwarg is not respected
assert OrmQ.objects.filter(key="testy-test").count() == 1