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

[MM-54520] Soft fail in case of missing post during state cleanup #530

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/channel_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (p *Plugin) cleanCallState(channelID string, state *channelState) error {

if state.Call != nil {
if _, err := p.updateCallPostEnded(state.Call.PostID, mapKeys(state.Call.Stats.Participants)); err != nil {
return err
p.LogError("failed to update call post", "err", err.Error())
}
state.Call = nil
}
Expand Down
4 changes: 4 additions & 0 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ func (p *Plugin) createCallStartedPost(state *channelState, userID, channelID, t
}

func (p *Plugin) updateCallPostEnded(postID string, participants []string) (float64, error) {
if postID == "" {
return 0, fmt.Errorf("postID should not be empty")
}

post, appErr := p.API.GetPost(postID)
if appErr != nil {
return 0, appErr
Expand Down