Skip to content

Commit

Permalink
Merge pull request wal-g#1334 from wal-g/fix-mongo-backup-list
Browse files Browse the repository at this point in the history
Fix sorting in detailed mongodb backup list
  • Loading branch information
KhurtinDN authored Sep 14, 2022
2 parents b55404c + 98f1b0d commit a72fb73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/databases/mongo/backup_list_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func HandleDetailedBackupList(folder storage.Folder, output io.Writer, pretty, j
}

sort.Slice(backupDetails, func(i, j int) bool {
return backupDetails[i].FinishLocalTime.After(backupDetails[j].FinishLocalTime)
return backupDetails[i].FinishLocalTime.Before(backupDetails[j].FinishLocalTime)
})

switch {
Expand Down
4 changes: 3 additions & 1 deletion internal/databases/mongo/binary/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func (backupService *BackupService) DoBackup(backupName string, permanent bool)
defer func() {
if err != nil {
closeErr := backupCursor.Close(backupService.Context)
tracelog.ErrorLogger.Printf("Unable to close backup cursor: %+v", closeErr)
if closeErr != nil {
tracelog.ErrorLogger.Printf("Unable to close backup cursor: %+v", closeErr)
}
}
}()

Expand Down

0 comments on commit a72fb73

Please sign in to comment.