Add warn log when deleting inactive users (#32318)

Add log for the problem #31480

(cherry picked from commit a264c46fb04112c5ec2c1b2acd523a2e4450da40)

Conflicts:
	- services/user/user.go
	  Resolved by manually adding the log line.
This commit is contained in:
Lunny Xiao 2024-10-23 09:28:28 +08:00 committed by Gergely Nagy
parent 8c79008d6f
commit 261c0a95b4
No known key found for this signature in database

View file

@ -306,6 +306,7 @@ func DeleteInactiveUsers(ctx context.Context, olderThan time.Duration) error {
// Ignore users that were set inactive by admin. // Ignore users that were set inactive by admin.
if models.IsErrUserOwnRepos(err) || models.IsErrUserHasOrgs(err) || if models.IsErrUserOwnRepos(err) || models.IsErrUserHasOrgs(err) ||
models.IsErrUserOwnPackages(err) || models.IsErrDeleteLastAdminUser(err) { models.IsErrUserOwnPackages(err) || models.IsErrDeleteLastAdminUser(err) {
log.Warn("Inactive user %q has repositories, organizations or packages, skipping deletion: %v", u.Name, err)
continue continue
} }
return err return err