diff --git a/conf/defaults.ini b/conf/defaults.ini index d0fc1133fac..a87aba10adb 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -256,9 +256,6 @@ login_maximum_lifetime_days = 30 # How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes. token_rotation_interval_minutes = 10 -# How often should expired auth tokens be deleted from the database. The default is each hour. -expired_tokens_cleanup_interval_hours = 1 - # Set to true to disable (hide) the login form, useful if you use OAuth disable_login_form = false diff --git a/conf/sample.ini b/conf/sample.ini index 2ff37239abf..dbbb3593f0f 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -236,9 +236,6 @@ log_queries = # How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes. ;token_rotation_interval_minutes = 10 -# How often should expired auth tokens be deleted from the database. The default is each hour. -;expired_tokens_cleanup_interval_hours = 1 - # Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false ;disable_login_form = false diff --git a/pkg/services/auth/auth_token_test.go b/pkg/services/auth/auth_token_test.go index 964bd499a01..26dcbc5c868 100644 --- a/pkg/services/auth/auth_token_test.go +++ b/pkg/services/auth/auth_token_test.go @@ -423,10 +423,9 @@ func createTestContext(t *testing.T) *testContext { tokenService := &UserAuthTokenService{ SQLStore: sqlstore, Cfg: &setting.Cfg{ - LoginMaxInactiveLifetimeDays: 7, - LoginMaxLifetimeDays: 30, - TokenRotationIntervalMinutes: 10, - ExpiredTokensCleanupIntervalHours: 1, + LoginMaxInactiveLifetimeDays: 7, + LoginMaxLifetimeDays: 30, + TokenRotationIntervalMinutes: 10, }, log: log.New("test-logger"), } diff --git a/pkg/services/auth/token_cleanup.go b/pkg/services/auth/token_cleanup.go index 0d5cbdaca10..aa5bc4856ab 100644 --- a/pkg/services/auth/token_cleanup.go +++ b/pkg/services/auth/token_cleanup.go @@ -6,8 +6,7 @@ import ( ) func (srv *UserAuthTokenService) Run(ctx context.Context) error { - jobInterval := time.Duration(srv.Cfg.ExpiredTokensCleanupIntervalHours) * time.Hour - ticker := time.NewTicker(jobInterval) + ticker := time.NewTicker(time.Hour) maxInactiveLifetime := time.Duration(srv.Cfg.LoginMaxInactiveLifetimeDays) * 24 * time.Hour maxLifetime := time.Duration(srv.Cfg.LoginMaxLifetimeDays) * 24 * time.Hour diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 43ac46e5ab8..21899482529 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -233,11 +233,10 @@ type Cfg struct { EnterpriseLicensePath string // Auth - LoginCookieName string - LoginMaxInactiveLifetimeDays int - LoginMaxLifetimeDays int - TokenRotationIntervalMinutes int - ExpiredTokensCleanupIntervalHours int + LoginCookieName string + LoginMaxInactiveLifetimeDays int + LoginMaxLifetimeDays int + TokenRotationIntervalMinutes int } type CommandLineArgs struct { @@ -673,7 +672,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error { if cfg.TokenRotationIntervalMinutes < 2 { cfg.TokenRotationIntervalMinutes = 2 } - cfg.ExpiredTokensCleanupIntervalHours = auth.Key("expired_tokens_cleanup_interval_hours").MustInt(1) DisableLoginForm = auth.Key("disable_login_form").MustBool(false) DisableSignoutMenu = auth.Key("disable_signout_menu").MustBool(false)