mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
MM-62900: Avoid redundant query for channelID while indexing file (#30289)
The file already has the ChannelID field. Therefore, we avoid querying the database again. This sometimes causes errors in customer environments where there is noticeable replication lag, causing files not to be indexed entirely. https://mattermost.atlassian.net/browse/MM-62900 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
a51a8e9b60
commit
5609489e86
1 changed files with 0 additions and 9 deletions
|
|
@ -26,15 +26,6 @@ func (s SearchFileInfoStore) indexFile(rctx request.CTX, file *model.FileInfo) {
|
|||
return
|
||||
}
|
||||
channelId := file.ChannelId
|
||||
if file.PostId != "" {
|
||||
post, postErr := s.rootStore.Post().GetSingle(rctx, file.PostId, false)
|
||||
if postErr != nil {
|
||||
rctx.Logger().Error("Couldn't get post for file for SearchEngine indexing.", mlog.String("post_id", file.PostId), mlog.String("search_engine", engineCopy.GetName()), mlog.String("file_info_id", file.Id), mlog.Err(postErr))
|
||||
return
|
||||
}
|
||||
channelId = post.ChannelId
|
||||
}
|
||||
|
||||
if channelId == "" {
|
||||
rctx.Logger().Error("Couldn't associate file with a channel for file for SearchEngine indexing.", mlog.String("search_engine", engineCopy.GetName()), mlog.String("file_info_id", file.Id))
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue