MM-60413: Fix issues due to incorrect cache provider (#28181)
We were using a mock cache provider which mixed up LRU caches with each other. This led to incorrect unmarshalling method calls. We fix this by using the real cache provider. https://mattermost.atlassian.net/browse/MM-60413 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1909206e16
Коммит
f18323980f
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/storetest"
|
||||
"github.com/mattermost/mattermost/server/v8/platform/services/cache"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@@ -108,7 +109,7 @@ func initStores(logger mlog.LoggerIFace) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
st.Store, err = NewLocalCacheLayer(st.SqlStore, nil, nil, getMockCacheProvider(), logger)
|
||||
st.Store, err = NewLocalCacheLayer(st.SqlStore, nil, nil, cache.NewProvider(), logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -84,8 +84,7 @@ func (s *LocalCacheUserStore) InvalidateProfilesInChannelCacheByUser(userId stri
|
||||
|
||||
toPass := make([]any, 0, len(keys))
|
||||
for i := 0; i < len(keys); i++ {
|
||||
// Note: keep https://github.com/mattermost/mattermost/pull/27830 in mind.
|
||||
var userMap map[string]*model.User
|
||||
var userMap model.UserMap
|
||||
toPass = append(toPass, &userMap)
|
||||
}
|
||||
errs := s.rootStore.doMultiReadCache(s.rootStore.profilesInChannelCache, keys, toPass)
|
||||
@@ -96,7 +95,7 @@ func (s *LocalCacheUserStore) InvalidateProfilesInChannelCacheByUser(userId stri
|
||||
}
|
||||
continue
|
||||
}
|
||||
gotMap := *(toPass[i].(*map[string]*model.User))
|
||||
gotMap := *(toPass[i].(*model.UserMap))
|
||||
if gotMap == nil {
|
||||
s.rootStore.logger.Warn("Found nil userMap in InvalidateProfilesInChannelCacheByUser. This is not expected")
|
||||
continue
|
||||
@@ -147,7 +146,7 @@ func (s *LocalCacheUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*
|
||||
|
||||
func (s *LocalCacheUserStore) GetAllProfilesInChannel(ctx context.Context, channelId string, allowFromCache bool) (map[string]*model.User, error) {
|
||||
if allowFromCache {
|
||||
var cachedMap map[string]*model.User
|
||||
var cachedMap model.UserMap
|
||||
if err := s.rootStore.doStandardReadCache(s.rootStore.profilesInChannelCache, channelId, &cachedMap); err == nil {
|
||||
return cachedMap, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user