-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
There was a problem hiding this 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'
}
lib/actions/reassemble.js
Outdated
if (messageData) { | ||
groupsSeen[groupId].incomingData[messageId] = messageData; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#65