Skip to content

Commit e0457a4

Browse files
committed
refactor: clean up code
1 parent d3efa3f commit e0457a4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/backup.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,9 @@ func BackupDatabase(disableCompression bool, prune bool, keepLast int) {
141141
log.Fatal(err)
142142
}
143143
utils.Done("Database has been backed up")
144-
145-
utils.Info(keepLast)
146-
utils.Info(prune)
147-
148144
//Delete old backup
149145
if prune {
150-
cleanBackup(keepLast)
146+
deleteOldBackup(keepLast)
151147
}
152148

153149
}
@@ -170,7 +166,7 @@ func s3Backup(disableCompression bool, s3Path string, prune bool, keepLast int)
170166
BackupDatabase(disableCompression, prune, keepLast)
171167
}
172168

173-
func cleanBackup(keepLast int) {
169+
func deleteOldBackup(keepLast int) {
174170
utils.Info("Deleting old backups...")
175171
storagePath = os.Getenv("STORAGE_PATH")
176172
// Define the directory path
@@ -184,7 +180,6 @@ func cleanBackup(keepLast int) {
184180
}
185181
// Check if the file is older than defined day days
186182
if info.Mode().IsRegular() && info.ModTime().Before(currentTime.AddDate(0, 0, -keepLast)) {
187-
//if info.Mode().IsRegular() && info.ModTime().Before(currentTime.Add(+2*time.Minute)) {
188183
// Remove the file
189184
err := os.Remove(path)
190185
if err != nil {

0 commit comments

Comments
 (0)