Created
July 11, 2014 21:30
-
-
Save ubershmekel/7c38943afccc58382e4a to your computer and use it in GitHub Desktop.
Kombu unacked messages were missing when calling .get()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Kombu and Celery were doing something strange were I noticed rabbit had | |
a large number of unacked messages, but when I hit .get() I got nothing. | |
This manifested on the client side of things at times where it would work once, | |
hang the next. And then work again. | |
""" | |
# This was the bad code | |
with kombu.Connection(RABBIT_HOST) as conn: | |
while True: | |
master_q = conn.SimpleQueue(MASTER_QUEUE) | |
print('getting') | |
msg = master_q.get() | |
# This was the good code, notice I don't redeclare the q in the loop | |
with kombu.Connection(RABBIT_HOST) as conn: | |
master_q = conn.SimpleQueue(MASTER_QUEUE) | |
while True: | |
print('getting') | |
msg = master_q.get() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment