You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a = dramatiq.Message("foo_queue", "foo_actor", (1,), {"x": 1}, {})
b = dramatiq.Message("foo_queue", "foo_actor", (1,), {"x": 1}, {})
a < b
What did you expect would happen?
Returns False.
What happened?
The Message.__lt__ operator attempts to compare the two kwargs dicts, which fails because dictionaries are not comparable:
def __lt__(self, other: "Message") -> bool:
> return dataclasses.astuple(self) < dataclasses.astuple(other)
E TypeError: '<' not supported between instances of 'dict' and 'dict'
Other notes
Specifically this came up from pushing (a, b, c, message) with equal (a, b, c) into a PriorityQueue inside a test-only synchronous broker.
But, I think the same issue could happen in dramatiq's production worker code here if a single worker process has multiple messages with the same priority, queue, actor, and args. We haven't ever seen this happen in production, but our configuration would make this extremely unlikely (one worker thread per process, with prefetch of 2).
I'm just reporting this so that you know about it in case you want to do something, no pressure to fix it :) Thanks for building + sharing such a great job system!
The text was updated successfully, but these errors were encountered:
Issues
Checklist
What OS are you using?
Ubuntu 24.04 LTS
What version of Dramatiq are you using?
1.14.2
What did you do?
What did you expect would happen?
Returns False.
What happened?
The
Message.__lt__
operator attempts to compare the two kwargs dicts, which fails because dictionaries are not comparable:Other notes
Specifically this came up from pushing
(a, b, c, message)
with equal(a, b, c)
into a PriorityQueue inside a test-only synchronous broker.But, I think the same issue could happen in dramatiq's production worker code here if a single worker process has multiple messages with the same priority, queue, actor, and args. We haven't ever seen this happen in production, but our configuration would make this extremely unlikely (one worker thread per process, with prefetch of 2).
I'm just reporting this so that you know about it in case you want to do something, no pressure to fix it :) Thanks for building + sharing such a great job system!
The text was updated successfully, but these errors were encountered: