Fix race condition in the web package (#29288)
Essentially applying the fix for https://github.com/mattermost/mattermost/pull/29214 to the web package. It seems like the app.StoreOverrideWithCache function was never used in this package. Just a small highlight of how much boilerplate is repeated in multiple packages ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ca51e33541
Коммит
d83156027a
@@ -23,7 +23,6 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/app"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/localcachelayer"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/storetest/mocks"
|
||||
"github.com/mattermost/mattermost/server/v8/config"
|
||||
)
|
||||
@@ -83,7 +82,12 @@ func setupTestHelper(tb testing.TB, includeCacheLayer bool, options []app.Option
|
||||
*newConfig.LogSettings.ConsoleLevel = mlog.LvlStdLog.Name
|
||||
memoryStore.Set(newConfig)
|
||||
options = append(options, app.ConfigStore(memoryStore))
|
||||
options = append(options, app.StoreOverride(mainHelper.Store))
|
||||
if includeCacheLayer {
|
||||
// Adds the cache layer to the test store
|
||||
options = append(options, app.StoreOverrideWithCache(mainHelper.Store))
|
||||
} else {
|
||||
options = append(options, app.StoreOverride(mainHelper.Store))
|
||||
}
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&newConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
@@ -98,15 +102,6 @@ func setupTestHelper(tb testing.TB, includeCacheLayer bool, options []app.Option
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if includeCacheLayer {
|
||||
// Adds the cache layer to the test store
|
||||
var st localcachelayer.LocalCacheStore
|
||||
st, err = localcachelayer.NewLocalCacheLayer(s.Store(), s.GetMetrics(), s.Platform().Cluster(), s.Platform().CacheProvider(), testLogger)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
s.SetStore(st)
|
||||
}
|
||||
|
||||
a := app.New(app.ServerConnector(s.Channels()))
|
||||
prevListenAddress := *s.Config().ServiceSettings.ListenAddress
|
||||
|
||||
Ссылка в новой задаче
Block a user