Skip to content

Commit

Permalink
Use a better OlderThan for DeleteInactiveUsers (#19693)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Gusted authored May 13, 2022
1 parent cafa2dc commit 61f9393
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/cron/tasks_extended.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func registerDeleteInactiveUsers() {
RunAtStart: false,
Schedule: "@annually",
},
OlderThan: 0 * time.Second,
OlderThan: time.Minute * time.Duration(setting.Service.ActiveCodeLives),
}, func(ctx context.Context, _ *user_model.User, config Config) error {
olderThanConfig := config.(*OlderThanConfig)
return user_service.DeleteInactiveUsers(ctx, olderThanConfig.OlderThan)
Expand Down

0 comments on commit 61f9393

Please sign in to comment.