kombu icon indicating copy to clipboard operation
kombu copied to clipboard

active_queues as set in redis transport does not maintain order

Open chadawagner opened this issue 7 years ago • 2 comments

https://github.com/celery/kombu/blob/488ed977e0345eb0f509f020a80bb88f42bb1315/kombu/transport/redis.py#L986-L989

When using the "priority" scheduling cycle with the redis transport, the original order of the list of queues to use is not preserved, due to _active_queues being converted from a list to a set and back again.

Is there a reason the active_queues property needs to be a set? As far as I can tell, it's only used to check if it's empty, check its length, and to update the queue cycle. Could we change it to just return a list instead? Or if duplicates are an issue, remove them while preserving order?

chadawagner avatar Sep 14 '17 18:09 chadawagner

did you find any solution? up for a PR?

auvipy avatar May 05 '20 10:05 auvipy

@auvipy I just monkeypatched that active_queues method to return a list rather than a set. Solved my problem but it could be a breaking change if anyone were doing something with the output of that method besides just iterating or checking length, or if the method is expected to remove duplicates.

chadawagner avatar May 05 '20 23:05 chadawagner