Chore: Remove unused CacheService dependency from sqlstore (#78507)

remove unused CacheService dependency from sqlstore
This commit is contained in:
Dan Cech
2023-12-04 16:00:45 +01:00
committed by GitHub
parent 637cfa89be
commit 318f51eaee
3 changed files with 7 additions and 14 deletions
+6 -9
View File
@@ -23,7 +23,6 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/fs"
"github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/registry"
@@ -42,9 +41,8 @@ import (
type ContextSessionKey struct{}
type SQLStore struct {
Cfg *setting.Cfg
sqlxsession *session.SessionDB
CacheService *localcache.CacheService
Cfg *setting.Cfg
sqlxsession *session.SessionDB
bus bus.Bus
dbCfg DatabaseConfig
@@ -58,12 +56,12 @@ type SQLStore struct {
recursiveQueriesMu sync.Mutex
}
func ProvideService(cfg *setting.Cfg, cacheService *localcache.CacheService, migrations registry.DatabaseMigrator, bus bus.Bus, tracer tracing.Tracer) (*SQLStore, error) {
func ProvideService(cfg *setting.Cfg, migrations registry.DatabaseMigrator, bus bus.Bus, tracer tracing.Tracer) (*SQLStore, error) {
// This change will make xorm use an empty default schema for postgres and
// by that mimic the functionality of how it was functioning before
// xorm's changes above.
xorm.DefaultPostgresSchema = ""
s, err := newSQLStore(cfg, cacheService, nil, migrations, bus, tracer)
s, err := newSQLStore(cfg, nil, migrations, bus, tracer)
if err != nil {
return nil, err
}
@@ -97,11 +95,10 @@ func ProvideServiceForTests(cfg *setting.Cfg, migrations registry.DatabaseMigrat
return initTestDB(cfg, migrations, InitTestDBOpt{EnsureDefaultOrgAndUser: true})
}
func newSQLStore(cfg *setting.Cfg, cacheService *localcache.CacheService, engine *xorm.Engine,
func newSQLStore(cfg *setting.Cfg, engine *xorm.Engine,
migrations registry.DatabaseMigrator, bus bus.Bus, tracer tracing.Tracer, opts ...InitTestDBOpt) (*SQLStore, error) {
ss := &SQLStore{
Cfg: cfg,
CacheService: cacheService,
log: log.New("sqlstore"),
skipEnsureDefaultOrgAndUser: false,
migrations: migrations,
@@ -703,7 +700,7 @@ func initTestDB(testCfg *setting.Cfg, migration registry.DatabaseMigrator, opts
tracer := tracing.InitializeTracerForTest()
bus := bus.ProvideBus(tracer)
testSQLStore, err = newSQLStore(cfg, localcache.New(5*time.Minute, 10*time.Minute), engine, migration, bus, tracer, opts...)
testSQLStore, err = newSQLStore(cfg, engine, migration, bus, tracer, opts...)
if err != nil {
return nil, err
}