1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: introduce dry run flag for data cleanup [skip ci]

This commit is contained in:
Ferdinand Mütsch
2023-01-18 09:26:01 +01:00
parent 8ccfcef8e3
commit a1048d480a
2 changed files with 5 additions and 0 deletions

View File

@@ -66,6 +66,10 @@ func (s *HousekeepingService) Schedule() {
func (s *HousekeepingService) CleanUserDataBefore(user *models.User, before time.Time) error {
logbuch.Warn("cleaning up user data for '%s' older than %v", user.ID, before)
if s.config.App.DataCleanupDryRun {
logbuch.Info("skipping actual data deletion for '%v', because this is just a dry run", user.ID)
return nil
}
// clear old heartbeats
if err := s.heartbeatSrvc.DeleteByUserBefore(user, before); err != nil {