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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a51a8e9b60
Коммит
5609489e86
@@ -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
|
||||
|
||||
Ссылка в новой задаче
Block a user