mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 15:43:23 -06:00
Chore: Remove unused CacheService dependency from sqlstore (#78507)
remove unused CacheService dependency from sqlstore
This commit is contained in:
parent
637cfa89be
commit
318f51eaee
@ -86,7 +86,7 @@ func getSqlStore(cfg *setting.Cfg) (*sqlstore.SQLStore, error) {
|
||||
return nil, fmt.Errorf("%v: %w", "failed to initialize tracer service", err)
|
||||
}
|
||||
bus := bus.ProvideBus(tracer)
|
||||
return sqlstore.ProvideService(cfg, nil, &migrations.OSSMigrations{}, bus, tracer)
|
||||
return sqlstore.ProvideService(cfg, &migrations.OSSMigrations{}, bus, tracer)
|
||||
}
|
||||
|
||||
func runListConflictUsers() func(context *cli.Context) error {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -377,8 +377,6 @@ func TestIntegrationUserDataAccess(t *testing.T) {
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
ss.CacheService.Flush()
|
||||
|
||||
query := &user.GetSignedInUserQuery{OrgID: users[1].OrgID, UserID: users[1].ID}
|
||||
result, err := userStore.GetSignedInUser(context.Background(), query)
|
||||
require.NoError(t, err)
|
||||
@ -541,8 +539,6 @@ func TestIntegrationUserDataAccess(t *testing.T) {
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
ss.CacheService.Flush()
|
||||
|
||||
query3 := &user.GetSignedInUserQuery{OrgID: users[1].OrgID, UserID: users[1].ID}
|
||||
query3Result, err := userStore.GetSignedInUser(context.Background(), query3)
|
||||
require.Nil(t, err)
|
||||
|
Loading…
Reference in New Issue
Block a user