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

Acknowledge websocket POSTED events when they should be #722

Merged
merged 7 commits into from
Apr 11, 2024
Merged

Conversation

devinbinnie
Copy link
Member

Summary

Adding to the load tester the changes needed to test this PR.
Marking as Draft for now since I think we might want to revisit how we want to queue the ACKs to send back.

Ticket Link

https://mattermost.atlassian.net/browse/MM-57006
https://mattermost.atlassian.net/browse/MM-57067

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Looks great! Just a couple of nits

@@ -36,6 +36,12 @@ func (c *SimulController) wsEventHandler(wg *sync.WaitGroup) {
break
}

if ack, ok := ev.GetData()["should_ack"]; ok && ack.(bool) {
Copy link
Member

Choose a reason for hiding this comment

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

Double-checking: What should we do if there's no "should_ack" key in the event data? Just skip?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. we only want to actually send the ACK back if the posted event has this flag, if not we shouldn't do anything.

Copy link
Member

Choose a reason for hiding this comment

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

Got it!

@@ -36,6 +36,12 @@ func (c *SimulController) wsEventHandler(wg *sync.WaitGroup) {
break
}

if ack, ok := ev.GetData()["should_ack"]; ok && ack.(bool) {
go func() {
c.user.PostedAck(post.Id, "success", "", "")
Copy link
Member

Choose a reason for hiding this comment

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

We should log the potential error returned by PostedAck

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. Do I need to just pass the error to the c.status channel if there is one?

Copy link
Member

Choose a reason for hiding this comment

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

Yup!

@devinbinnie devinbinnie marked this pull request as ready for review April 8, 2024 15:44
Copy link
Contributor

@streamer45 streamer45 left a comment

Choose a reason for hiding this comment

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

Thanks Devin, looks good 👍

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Thank you, Devin, this looks great!

@devinbinnie devinbinnie merged commit 2ac55d1 into master Apr 11, 2024
1 check passed
@devinbinnie devinbinnie deleted the lt_ack branch April 11, 2024 19:54
fmartingr pushed a commit that referenced this pull request Apr 18, 2024
* WIP

* Use a goroutine for the ACK

* Only ACK other users posts

* Only ack if the prop is true

* Change the ack name

* Use non-blocking call to buffered channel
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