[MM-23510] Avoid race condition searching post's channel by channel id instead of post id (#14154)

Этот коммит содержится в:
Miguel de la Cruz
2020-03-25 23:50:11 +01:00
коммит произвёл GitHub
родитель c4701394d3
Коммит 11debb55a6

Просмотреть файл

@@ -19,9 +19,9 @@ func (s SearchPostStore) indexPost(post *model.Post) {
for _, engine := range s.rootStore.searchEngine.GetActiveEngines() {
if engine.IsIndexingEnabled() {
go (func(engineCopy searchengine.SearchEngineInterface) {
channel, chanErr := s.rootStore.Channel().GetForPost(post.Id)
channel, chanErr := s.rootStore.Channel().Get(post.ChannelId, true)
if chanErr != nil {
mlog.Error("Couldn't get channel for post for SearchEngine indexing.", mlog.String("channel_id", post.ChannelId), mlog.String("search_engine", engineCopy.GetName()), mlog.String("post_id", post.Id))
mlog.Error("Couldn't get channel for post for SearchEngine indexing.", mlog.String("channel_id", post.ChannelId), mlog.String("search_engine", engineCopy.GetName()), mlog.String("post_id", post.Id), mlog.Err(chanErr))
return
}
if err := engineCopy.IndexPost(post, channel.TeamId); err != nil {