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(ws): performance improvements #4142

Merged
merged 3 commits into from
Sep 18, 2023
Merged

Conversation

p-fernandez
Copy link
Contributor

@p-fernandez p-fernandez commented Sep 11, 2023

What change does this PR introduce?

Integrates two tasks to improve the performance of the WebSockets.

Why was this change needed?

Performance improvements identified while migrating MemoryDB.

Other information (Screenshots)

@p-fernandez p-fernandez self-assigned this Sep 11, 2023
@p-fernandez p-fernandez force-pushed the feat-ws-performance-improvements branch from 21deab7 to 4466e50 Compare September 12, 2023 17:23
Copy link
Contributor

@LetItRock LetItRock left a comment

Choose a reason for hiding this comment

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

do we need this one if you did changes here?
https://github.com/novuhq/novu/pull/4126/files#r1319969641

@p-fernandez p-fernandez force-pushed the feat-ws-performance-improvements branch from 31eb912 to 9d42f8d Compare September 13, 2023 12:01
@p-fernandez
Copy link
Contributor Author

p-fernandez commented Sep 13, 2023

do we need this one if you did changes here? https://github.com/novuhq/novu/pull/4126/files#r1319969641

A change from next was needed to create the feature PR.

Comment on lines +23 to +29
if (command.event === WebSocketEventEnum.UNSEEN) {
await this.sendUnseenCountChange(command);
}

if (command.event === WebSocketEventEnum.UNREAD) {
await this.sendUnreadCountChange(command);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still needed or it's for backwards compatible version of a worker? Since if we now only send the RECEIVED those will never run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned it here: #4152 (comment)
Headless and Notification Center still use those events. @LetItRock confirmed.

Copy link
Contributor

Choose a reason for hiding this comment

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

They used to listen to them, but the only producer of those is the worker from my memory. After your refactoring they will still get them because of line https://github.com/novuhq/novu/pull/4142/files#diff-69a5fd44e678889585214e635e81e988c3a95a541e36d30df6de70d7e345bcd3R47

So those lines I'm seeing here should only executed if the worker still sends the old event names. If that makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here they are used as events are being sent:

Copy link
Contributor

Choose a reason for hiding this comment

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

Very good Catch! Totally forgot about it 💪

Copy link
Contributor

@scopsy scopsy 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 small question about the retro-competitive part, if it is for that than looks good🙏

@scopsy scopsy merged commit 0444214 into next Sep 18, 2023
25 checks passed
@scopsy scopsy deleted the feat-ws-performance-improvements branch September 18, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants