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

Ensure Module Order Matches the Sequence Constructed by BuildModules() #127

Open
wants to merge 1 commit into
base: cosmos/v0.50.x
Choose a base branch
from

Conversation

zenzenless
Copy link

Description

This PR modifies the GetModules function to ensure that the execution order of modules aligns with the sequence constructed by the developer using BuildModules(), rather than relying on the order in the config.yml file. In certain cases, the execution order of specific modules is critical. For example, in the Callisto project, the message_type module must execute before the messages module to prevent database insertion failures due to the foreign key relationship that messages has with message_type.

If the order is not ensured correctly, errors such as the following may occur:

ERR error while handling message err="pq: insert or update on table \"message_0\" violates foreign key constraint \"message_type_fkey\""

Changes Made

Updated the GetModules function to check and return modules in the specified order based on the provided names.
Added validation to log errors for any required but unregistered modules.

Please review these changes to ensure they meet the project's requirements and best practices.

Checklist

  • Targeted PR against correct branch.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit tests.
  • Re-reviewed Files changed in the Github PR explorer.

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.

1 participant