MM-60606: Respect allowFromCache flag in Channelstore.GetMany (#28290)
Setting the flag to false never worked, and it was never caught because there wasn't an instance when this method was called with allowFromCache=false. https://mattermost.atlassian.net/browse/MM-60606 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9447cb9074
Коммит
5a511a14ee
@@ -211,7 +211,6 @@ func (s LocalCacheChannelStore) GetPinnedPostCount(channelId string, allowFromCa
|
||||
}
|
||||
|
||||
count, err := s.ChannelStore.GetPinnedPostCount(channelId, allowFromCache)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -244,22 +243,24 @@ func (s LocalCacheChannelStore) GetMany(ids []string, allowFromCache bool) (mode
|
||||
var foundChannels []*model.Channel
|
||||
var channelsToQuery []string
|
||||
|
||||
if allowFromCache {
|
||||
toPass := allocateCacheTargets[*model.Channel](len(ids))
|
||||
errs := s.rootStore.doMultiReadCache(s.rootStore.roleCache, ids, toPass)
|
||||
for i, err := range errs {
|
||||
if err != nil {
|
||||
if err != cache.ErrKeyNotFound {
|
||||
s.rootStore.logger.Warn("Error in Channelstore.GetMany: ", mlog.Err(err))
|
||||
}
|
||||
channelsToQuery = append(channelsToQuery, ids[i])
|
||||
if !allowFromCache {
|
||||
return s.ChannelStore.GetMany(ids, allowFromCache)
|
||||
}
|
||||
|
||||
toPass := allocateCacheTargets[*model.Channel](len(ids))
|
||||
errs := s.rootStore.doMultiReadCache(s.rootStore.roleCache, ids, toPass)
|
||||
for i, err := range errs {
|
||||
if err != nil {
|
||||
if err != cache.ErrKeyNotFound {
|
||||
s.rootStore.logger.Warn("Error in Channelstore.GetMany: ", mlog.Err(err))
|
||||
}
|
||||
channelsToQuery = append(channelsToQuery, ids[i])
|
||||
} else {
|
||||
gotChannel := *(toPass[i].(**model.Channel))
|
||||
if gotChannel != nil {
|
||||
foundChannels = append(foundChannels, gotChannel)
|
||||
} else {
|
||||
gotChannel := *(toPass[i].(**model.Channel))
|
||||
if gotChannel != nil {
|
||||
foundChannels = append(foundChannels, gotChannel)
|
||||
} else {
|
||||
s.rootStore.logger.Warn("Found nil channel in GetMany. This is not expected")
|
||||
}
|
||||
s.rootStore.logger.Warn("Found nil channel in GetMany. This is not expected")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user