Skip to content

Fix: always acknowledge MQ message in message websocket #425

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

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/aleph/web/controllers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,12 @@ async def messages_ws(request: web.Request) -> web.WebSocketResponse:
try:
async with mq_queue.iterator() as queue_iter:
async for mq_message in queue_iter:
# Always acknowledge the message
await mq_message.ack()

if ws.closed:
break

await mq_message.ack()
item_hash = aleph_json.loads(mq_message.body)["item_hash"]
# A bastardized way to apply the filters on the message as well.
# TODO: put the filter key/values in the RabbitMQ message?
Expand Down