Skip to content

Commit 61f9393

Browse files
author
Gusted
authored
Use a better OlderThan for DeleteInactiveUsers (#19693)
* Use a better OlderThan for DeleteInactiveUsers - Currently the OlderThan is zero, for instances that enable or run this task this could actually delete just new users that still need to confirm their email. This patch fixes that by setting the default to the `ActiveCodeLives` setting, which corresponds to the amount of time that a user can active their account, thus avoiding the issue of deleting unactivated email users. * Use correct duration
1 parent cafa2dc commit 61f9393

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/cron/tasks_extended.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func registerDeleteInactiveUsers() {
2626
RunAtStart: false,
2727
Schedule: "@annually",
2828
},
29-
OlderThan: 0 * time.Second,
29+
OlderThan: time.Minute * time.Duration(setting.Service.ActiveCodeLives),
3030
}, func(ctx context.Context, _ *user_model.User, config Config) error {
3131
olderThanConfig := config.(*OlderThanConfig)
3232
return user_service.DeleteInactiveUsers(ctx, olderThanConfig.OlderThan)

0 commit comments

Comments
 (0)