feat: add more debug logging when deleting users

related to #1021
This commit is contained in:
kolaente 2021-10-27 22:08:11 +02:00
parent 9869fd694a
commit 8f55af07c9
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 11 additions and 3 deletions

View file

@ -54,9 +54,13 @@ func deleteUsers() {
return return
} }
log.Debugf("Found %d users scheduled for deletion", len(users))
now := time.Now()
for _, u := range users { for _, u := range users {
if u.DeletionScheduledAt.Before(time.Now()) { if u.DeletionScheduledAt.Before(now) {
log.Debugf("User %d is not yet scheduled for deletion.", u.ID) log.Debugf("User %d is not yet scheduled for deletion. Scheduled at %s, now is %s", u.ID, u.DeletionScheduledAt, now)
continue continue
} }
@ -73,6 +77,8 @@ func deleteUsers() {
return return
} }
log.Debugf("Deleted user %d", u.ID)
err = s.Commit() err = s.Commit()
if err != nil { if err != nil {
log.Errorf("Could not commit transaction: %s", err) log.Errorf("Could not commit transaction: %s", err)

View file

@ -49,7 +49,7 @@ func notifyUsersScheduledForDeletion() {
return return
} }
log.Debugf("Found %d users scheduled for deletion", len(users)) log.Debugf("Found %d users scheduled for deletion to notify", len(users))
for _, user := range users { for _, user := range users {
if time.Since(user.DeletionLastReminderSent) < time.Hour*24 { if time.Since(user.DeletionLastReminderSent) < time.Hour*24 {
@ -64,6 +64,8 @@ func notifyUsersScheduledForDeletion() {
number = 3 number = 3
} }
log.Debugf("Notifying user %d of the deletion of their account...", user.ID)
err = notifications.Notify(user, &AccountDeletionNotification{ err = notifications.Notify(user, &AccountDeletionNotification{
User: user, User: user,
NotificationNumber: number, NotificationNumber: number,