parent
9869fd694a
commit
8f55af07c9
2 changed files with 11 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue