parent
9869fd694a
commit
8f55af07c9
2 changed files with 11 additions and 3 deletions
|
@ -54,9 +54,13 @@ func deleteUsers() {
|
|||
return
|
||||
}
|
||||
|
||||
log.Debugf("Found %d users scheduled for deletion", len(users))
|
||||
|
||||
now := time.Now()
|
||||
|
||||
for _, u := range users {
|
||||
if u.DeletionScheduledAt.Before(time.Now()) {
|
||||
log.Debugf("User %d is not yet scheduled for deletion.", u.ID)
|
||||
if u.DeletionScheduledAt.Before(now) {
|
||||
log.Debugf("User %d is not yet scheduled for deletion. Scheduled at %s, now is %s", u.ID, u.DeletionScheduledAt, now)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -73,6 +77,8 @@ func deleteUsers() {
|
|||
return
|
||||
}
|
||||
|
||||
log.Debugf("Deleted user %d", u.ID)
|
||||
|
||||
err = s.Commit()
|
||||
if err != nil {
|
||||
log.Errorf("Could not commit transaction: %s", err)
|
||||
|
|
|
@ -49,7 +49,7 @@ func notifyUsersScheduledForDeletion() {
|
|||
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 {
|
||||
if time.Since(user.DeletionLastReminderSent) < time.Hour*24 {
|
||||
|
@ -64,6 +64,8 @@ func notifyUsersScheduledForDeletion() {
|
|||
number = 3
|
||||
}
|
||||
|
||||
log.Debugf("Notifying user %d of the deletion of their account...", user.ID)
|
||||
|
||||
err = notifications.Notify(user, &AccountDeletionNotification{
|
||||
User: user,
|
||||
NotificationNumber: number,
|
||||
|
|
Loading…
Reference in a new issue