remove more global refs (#7480)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
adab1a660f
Коммит
266ff86702
@@ -24,11 +24,11 @@ type LayeredStore struct {
|
||||
LayerChainHead LayeredStoreSupplier
|
||||
}
|
||||
|
||||
func NewLayeredStore() Store {
|
||||
func NewLayeredStore(metrics einterfaces.MetricsInterface, cluster einterfaces.ClusterInterface) Store {
|
||||
store := &LayeredStore{
|
||||
TmpContext: context.TODO(),
|
||||
DatabaseLayer: NewSqlSupplier(einterfaces.GetMetricsInterface()),
|
||||
LocalCacheLayer: NewLocalCacheSupplier(einterfaces.GetMetricsInterface(), einterfaces.GetClusterInterface()),
|
||||
DatabaseLayer: NewSqlSupplier(metrics),
|
||||
LocalCacheLayer: NewLocalCacheSupplier(metrics, cluster),
|
||||
}
|
||||
|
||||
store.ReactionStore = &LayeredReactionStore{store}
|
||||
|
||||
@@ -32,15 +32,11 @@ func NewLocalCacheSupplier(metrics einterfaces.MetricsInterface, cluster einterf
|
||||
cluster: cluster,
|
||||
}
|
||||
|
||||
registerClusterHandlers(supplier)
|
||||
|
||||
return supplier
|
||||
}
|
||||
|
||||
func registerClusterHandlers(supplier *LocalCacheSupplier) {
|
||||
if cluster := einterfaces.GetClusterInterface(); cluster != nil {
|
||||
if cluster != nil {
|
||||
cluster.RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS, supplier.handleClusterInvalidateReaction)
|
||||
}
|
||||
|
||||
return supplier
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) SetChainNext(next LayeredStoreSupplier) {
|
||||
|
||||
@@ -12,7 +12,7 @@ func Setup() {
|
||||
utils.TranslationsPreInit()
|
||||
utils.LoadConfig("config.json")
|
||||
utils.InitTranslations(utils.Cfg.LocalizationSettings)
|
||||
store = NewLayeredStore()
|
||||
store = NewLayeredStore(nil, nil)
|
||||
|
||||
store.MarkSystemRanUnitTests()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user