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

feat(NODE-4139): streaming protocol message changes #3256

Merged
merged 7 commits into from May 23, 2022
Merged

Conversation

durran
Copy link
Member

@durran durran commented May 19, 2022

Description

Only emits the last message from the message stream's buffer when using the streaming protocol.

What is changing?

The monitor will now tell the connection that it's using the streaming protocol, which in turn will
set the flag on the connection's message stream. When the stream is in this mode, it will only ever
emit the message event with the very last message in the buffer pool. So if there's more data in the
buffer, the stream essentially skips its emit.

Is there new documentation needed for these changes?

None

What is the motivation for this change?

NODE-4139

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

When the monitor detects it is using the streaming protocol
we now tell the message stream to only ever emit the last
message in the buffer.
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

just a couple of things on the tests; the implementation looks good to me

test/unit/cmap/message_stream.test.js Outdated Show resolved Hide resolved
test/unit/cmap/message_stream.test.js Outdated Show resolved Hide resolved
test/unit/cmap/message_stream.test.js Outdated Show resolved Hide resolved
@dariakp dariakp added the Team Review Needs review from team label May 19, 2022
src/cmap/message_stream.ts Show resolved Hide resolved
src/cmap/message_stream.ts Outdated Show resolved Hide resolved
src/cmap/message_stream.ts Outdated Show resolved Hide resolved
@durran
Copy link
Member Author

durran commented May 20, 2022

Screenshot 2022-05-20 at 15 39 47

Seem to all be around 300-400ms now.

@durran durran requested review from jyemin and dariakp May 20, 2022 13:42
Copy link

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

Looking to those logs, I wonder if we have another problem (which we could choose to ignore): could this change result in unmatched heartbeat started/succeeded events? Or could that already happen even in the current implementation?

src/cmap/message_stream.ts Outdated Show resolved Hide resolved
src/cmap/message_stream.ts Show resolved Hide resolved
test/unit/cmap/message_stream.test.js Outdated Show resolved Hide resolved
src/cmap/message_stream.ts Show resolved Hide resolved
src/cmap/message_stream.ts Outdated Show resolved Hide resolved
src/sdam/monitor.ts Outdated Show resolved Hide resolved
jyemin
jyemin previously approved these changes May 23, 2022
Copy link

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

just one suggestion to better isolate the condition under test

test/unit/cmap/message_stream.test.js Show resolved Hide resolved
@dariakp dariakp merged commit 4b9ad77 into main May 23, 2022
@dariakp dariakp deleted the NODE-4139-ms branch May 23, 2022 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
3 participants