Skip to content

Fix: add origin pending message field #677

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 8 commits into from
Jan 14, 2025

Conversation

1yam
Copy link
Member

@1yam 1yam commented Jan 13, 2025

This PR should solve P2P issue, over the network

Related Clickup or Jira tickets : ALEPH-XXX

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

This pull request introduces the origin field to the pending_messages table and updates relevant parts of the codebase to handle this new field. The changes ensure that the origin of each pending message is tracked and processed appropriately.

Database Migration:

  • Added a new column origin to the pending_messages table with a default value of "p2p".

Model Updates:

  • Imported MessageOrigin in src/aleph/db/models/pending_messages.py and added the origin field to the PendingMessageDb class. [1] [2]
  • Updated the from_obj method in PendingMessageDb to include the origin parameter. [1] [2]

Handler and Job Updates:

  • Updated the message_handler.py to handle the origin field in various methods, including _publish_pending_message, add_pending_message, and process. [1] [2] [3] [4] [5]
  • Updated process_pending_messages.py and process_pending_txs.py to handle the origin field when publishing messages to the message queue. [1] [2] [3] [4]

Type and Status Updates:

  • Added origin to the MessageProcessingResult protocol and updated the ProcessedMessage class to handle the origin field. [1] [2]
  • Introduced the MessageOrigin class in message_status.py to define possible origins of messages.

@1yam 1yam requested a review from nesitor January 13, 2025 16:48
@nesitor nesitor assigned aliel and 1yam and unassigned aliel Jan 13, 2025
@nesitor nesitor requested review from aliel and amalcaraz January 13, 2025 17:46
@nesitor nesitor merged commit 2ec5c83 into main Jan 14, 2025
4 checks passed
@nesitor nesitor deleted the 1yam-fix-add_origin_pending_message_field branch January 14, 2025 12:57
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.

3 participants