Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages might not be acked when shutting down on rabbit #148

davidt99 opened this issue Dec 20, 2018 · 0 comments

Messages might not be acked when shutting down on rabbit #148

davidt99 opened this issue Dec 20, 2018 · 0 comments


Copy link

@davidt99 davidt99 commented Dec 20, 2018

Since dramatiq 1.3 the messages are acked in the background using add_callback_threadsafe, I had few times where a message should have been acked but the background thread didn't have the changes to run.
One solution is to switch to synchronous ack, or call connection.sleep(1) when the closing the connection (kinda hacky).

To reproduce, add this middleware to rabbitmq broker and send any message. When shutting down, most of the time both the delay queue and the default queue will have the same message:

class RetryMiddleware(dramatiq.middleware.Middleware):
    def after_process_message(self, broker, message, *, result=None, exception=None):
        broker.enqueue(message, delay=1000)

As a side note, overriding the relevant methods (ack, nack and close) wasn't convenient since the rabbit consumer is private and the broker doesn't have consumer class parameter, only consume method.

@Bogdanp Bogdanp self-assigned this Dec 22, 2018
@Bogdanp Bogdanp added the bug label Dec 22, 2018
@Bogdanp Bogdanp closed this in 792fdfe Dec 23, 2018
@Bogdanp Bogdanp added this to the v1.4.1 milestone Dec 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants