From fb5e3edeaa21a43e42348a5aa2d6d161a4b20518 Mon Sep 17 00:00:00 2001 From: streamer45 Date: Mon, 25 Sep 2023 09:16:47 -0600 Subject: [PATCH 1/2] Soft fail in case of missing post during state cleanup --- server/channel_state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/channel_state.go b/server/channel_state.go index 18fe65a0b..85f6d2afd 100644 --- a/server/channel_state.go +++ b/server/channel_state.go @@ -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 } From ca5f54feb59688ad105814eee510f28e5107caae Mon Sep 17 00:00:00 2001 From: streamer45 Date: Mon, 25 Sep 2023 14:21:58 -0600 Subject: [PATCH 2/2] Add validity check on postID --- server/plugin.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/plugin.go b/server/plugin.go index 241dd90eb..7881157a3 100644 --- a/server/plugin.go +++ b/server/plugin.go @@ -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