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

Remove double ack() method call #647

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

nesitor
Copy link
Member

@nesitor nesitor commented Nov 15, 2024

Self proofreading checklist

  • Is my code clear enough and well documented
  • Are my files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • Database migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Changes

With the patch done one version 0.5.7 we added a call to ACK the messages already handled before, but indeed it was already done by the receive_messages() method, so we end with these kind of errors:

2024-11-12 13:55:03 [ERROR] aleph.services.p2p.protocol: Exception in pubsub, reconnecting.
Traceback (most recent call last):
  File "/opt/pyaleph/src/aleph/services/p2p/protocol.py", line 25, in incoming_channel
    async for message in p2p_client.receive_messages(topic):
  File "/opt/venv/lib/python3.12/site-packages/aleph_p2p_client/client.py", line 158, in receive_messages
    async for message in self.mq_client.receive_messages(topic):
  File "/opt/venv/lib/python3.12/site-packages/aleph_p2p_client/client.py", line 73, in receive_messages
    await message.ack()
  File "/opt/venv/lib/python3.12/site-packages/aio_pika/message.py", line 473, in ack
    raise MessageProcessError("Message already processed", self)
aio_pika.exceptions.MessageProcessError: ('Message already processed', IncomingMessage:{'app_id': None,
 'body_size': 942,
 'cluster_id': '',
 'consumer_tag': 'ctag1.4b95afd181cd43579d7ab7384277396a',
 'content_encoding': None,
 'content_type': None,
 'correlation_id': None,
 'delivery_mode': <DeliveryMode.NOT_PERSISTENT: 1>,
 'delivery_tag': 217671,
 'exchange': 'p2p-subscribe',
 'expiration': None,
 'headers': {},
 'message_id': None,
 'routing_key': 'p2p.ALEPH-TEST.QmTqK74SCKQ7EKqPU8Dam43XjiCGLe2GgY6Yv6Ezy9zDvb',
 'timestamp': None,
 'type': 'None',
 'user_id': None})

Removing these double .ack() method call, we remove the existing error messages.

How to test

Deploy the version and ensure to not see more 'Message already processed' errors in the logs.

@nesitor nesitor requested a review from aliel November 15, 2024 04:52
@nesitor nesitor self-assigned this Nov 15, 2024
@aliel aliel merged commit 26f6d7d into main Nov 15, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants