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

Add Ability to pass data from the individual messages to re-assembled message #69

Merged
merged 7 commits into from
Jul 8, 2021

Conversation

shulkaolka
Copy link
Contributor

#65

@shulkaolka shulkaolka requested a review from jhorbulyk July 4, 2021 18:27
@shulkaolka shulkaolka requested a review from jhorbulyk July 5, 2021 19:15
Copy link
Contributor

@jhorbulyk jhorbulyk left a comment

Choose a reason for hiding this comment

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

Here is a possible way to update the test case Interleaved Case with duplicate deliveries:

Set the msgBodies to

[
      { groupId: '1', groupSize: 3, messageId: '1', messageData: '1-1', },
      { groupId: '2', groupSize: 2, messageId: '1', messageData: '2-1', },
      { groupId: '2', groupSize: 2, messageId: '1', messageData: '2-1', },
      { groupId: '1', groupSize: 3, messageId: '3', messageData: '1-3', },
      { groupId: '2', groupSize: 2, messageId: '2', messageData: '2-2', },
      { groupId: '1', groupSize: 3, messageId: '2', messageData: '1-2', },
]

Then messageData for group 2 should be

{
  '1': '2-1',
  '2': '2-2'
}

and messageData for group 1 should be

{
  '1': '1-1',
  '2': '1-2',
  '3', '1-3'
}

@shulkaolka shulkaolka requested a review from jhorbulyk July 7, 2021 20:07
Comment on lines 26 to 28
if (messageData) {
groupsSeen[groupId].incomingData[messageId] = messageData;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (messageData) {
groupsSeen[groupId].incomingData[messageId] = messageData;
}
groupsSeen[groupId].incomingData[messageId] = messageData;

I think we can skip the if (messageData) check and assign the messageData variable regardless. It could be that messageData is false at which point it may make sense to pass it through.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was changed to if (messageData !== undefined), otherwise incoming data includes an object with message id key with value = undefined. Or I should leave undefined value as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can leave undefined as well since when a JS object is converted to JSON, properties with undefined will be not included in the output JSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@shulkaolka shulkaolka requested a review from jhorbulyk July 8, 2021 07:57
@shulkaolka shulkaolka changed the base branch from sprint-68 to master July 8, 2021 20:50
@shulkaolka shulkaolka merged commit c358bfe into master Jul 8, 2021
@shulkaolka shulkaolka deleted the pass-data branch July 8, 2021 20:50
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