mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-56925: Fix unnecessary cache invalidation of pinned post count (#26264)
invalidateCacheForChannelPosts invalidated the pinned post count and the lastPostTime cache. But not all endpoints actually pins or unpins the post. That's only possible via the UpdatePost or PatchPost methods. Therefore, we remove the unnecessary cache invalidation. This is also important because this gets called for every single channel load, and every new post would invalidate this cache. https://mattermost.atlassian.net/browse/MM-56925 ```release-note NONE ```
This commit is contained in:
parent
1ae96cefad
commit
401de9b321
@ -489,7 +489,10 @@ func (a *App) handlePostEvents(c request.CTX, post *model.Post, user *model.User
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.Srv().Platform().InvalidateCacheForChannel(channel)
|
a.Srv().Platform().InvalidateCacheForChannel(channel)
|
||||||
a.invalidateCacheForChannelPosts(channel.Id)
|
if post.IsPinned {
|
||||||
|
a.Srv().Store().Channel().InvalidatePinnedPostCount(channel.Id)
|
||||||
|
}
|
||||||
|
a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id)
|
||||||
|
|
||||||
if _, err := a.SendNotifications(c, post, team, channel, user, parentPostList, setOnline); err != nil {
|
if _, err := a.SendNotifications(c, post, team, channel, user, parentPostList, setOnline); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -46,11 +46,9 @@ func (a *App) SaveAcknowledgementForPost(c request.CTX, postID, userID string) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The post is always modified since the UpdateAt always changes
|
// The post is always modified since the UpdateAt always changes
|
||||||
a.invalidateCacheForChannelPosts(channel.Id)
|
a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id)
|
||||||
|
|
||||||
a.Srv().Go(func() {
|
a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementAdded, acknowledgement, post)
|
||||||
a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementAdded, acknowledgement, post)
|
|
||||||
})
|
|
||||||
|
|
||||||
return acknowledgement, nil
|
return acknowledgement, nil
|
||||||
}
|
}
|
||||||
@ -92,11 +90,9 @@ func (a *App) DeleteAcknowledgementForPost(c request.CTX, postID, userID string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The post is always modified since the UpdateAt always changes
|
// The post is always modified since the UpdateAt always changes
|
||||||
a.invalidateCacheForChannelPosts(channel.Id)
|
a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id)
|
||||||
|
|
||||||
a.Srv().Go(func() {
|
a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementRemoved, oldAck, post)
|
||||||
a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementRemoved, oldAck, post)
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ func (a *App) SaveReactionForPost(c request.CTX, reaction *model.Reaction) (*mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The post is always modified since the UpdateAt always changes
|
// The post is always modified since the UpdateAt always changes
|
||||||
a.invalidateCacheForChannelPosts(post.ChannelId)
|
a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id)
|
||||||
|
|
||||||
pluginContext := pluginContext(c)
|
pluginContext := pluginContext(c)
|
||||||
a.Srv().Go(func() {
|
a.Srv().Go(func() {
|
||||||
@ -144,7 +144,7 @@ func (a *App) DeleteReactionForPost(c request.CTX, reaction *model.Reaction) *mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The post is always modified since the UpdateAt always changes
|
// The post is always modified since the UpdateAt always changes
|
||||||
a.invalidateCacheForChannelPosts(post.ChannelId)
|
a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id)
|
||||||
|
|
||||||
pluginContext := pluginContext(c)
|
pluginContext := pluginContext(c)
|
||||||
a.Srv().Go(func() {
|
a.Srv().Go(func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user