diff --git a/pkg/cmd/grafana-cli/commands/conflict_user_command.go b/pkg/cmd/grafana-cli/commands/conflict_user_command.go index b9243ddf1b3..8bccb53bdab 100644 --- a/pkg/cmd/grafana-cli/commands/conflict_user_command.go +++ b/pkg/cmd/grafana-cli/commands/conflict_user_command.go @@ -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 { diff --git a/pkg/services/sqlstore/sqlstore.go b/pkg/services/sqlstore/sqlstore.go index 342e72f4fdb..32e34fc3457 100644 --- a/pkg/services/sqlstore/sqlstore.go +++ b/pkg/services/sqlstore/sqlstore.go @@ -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 } diff --git a/pkg/services/user/userimpl/store_test.go b/pkg/services/user/userimpl/store_test.go index 21a0cfbbee0..4940bb7d15f 100644 --- a/pkg/services/user/userimpl/store_test.go +++ b/pkg/services/user/userimpl/store_test.go @@ -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)