-
Notifications
You must be signed in to change notification settings - Fork 42
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
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.
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) { |
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.
Double-checking: What should we do if there's no "should_ack"
key in the event data? Just skip?
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.
Correct. we only want to actually send the ACK back if the posted event has this flag, if not we shouldn't do anything.
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.
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", "", "") |
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.
We should log the potential error returned by PostedAck
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.
Good call. Do I need to just pass the error to the c.status
channel if there is one?
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.
Yup!
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.
Thanks Devin, looks good 👍
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.
Thank you, Devin, this looks great!
* 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
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