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

Refactor readMetadataForMessageLinking so it doesn't return itself #1043

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

basiliskus
Copy link
Contributor

@basiliskus basiliskus commented Apr 24, 2024

Refactor readMetadataForMessageLinking so it doesn't return itself

This is a fix in the linking logic so it only matches when there's at least one pair

Issue

#621

Checklist

  • I have added tests to cover my changes
  • I have added logging where useful (with appropriate log level)
  • I have added JavaDocs where required
  • I have updated the documentation accordingly

Copy link

Comment on lines 70 to +76
if (messageIdsToLink == null || messageIdsToLink.isEmpty()) {
return;
}

// Add receivedSubmissionId to complete the list of messageIds to link
messageIdsToLink.add(receivedSubmissionId);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work correctly now?

Did partnerMetadataOrchestrator.findMessagesIdsToLink(receivedSubmissionId) return receivedSubmissionId in the returned set, but now it doesn't? Is it possible that the if statement now always returns an empty set if this is the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, findMessagesIdsToLink was returning receivedSubmissionId in the set. The problem with the previous logic and query is that it will return a record even if there's no pair to match, as it will always return itself. In this case, if there's a pair to match, it will return that so if won't be empty. If there's no pair to match, we want to return an empty set

@basiliskus basiliskus marked this pull request as ready for review April 25, 2024 15:43
Copy link
Contributor

@luis-pabon-tf luis-pabon-tf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are exactly what the PR says they should do, and even full coverage!

Copy link
Member

@halprin halprin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining it to me!

@basiliskus basiliskus merged commit 815cb40 into main Apr 25, 2024
15 checks passed
@basiliskus basiliskus deleted the story/621/fix-link-query branch April 25, 2024 18:27
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