From 65ffa38edc5f0505e07647ee48cf092bc6891817 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Thu, 14 Jan 2021 16:39:49 +0100 Subject: [PATCH] Fixed reduntant bug --- backups/app/specs/specs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backups/app/specs/specs.py b/backups/app/specs/specs.py index bca52fc..5bf5379 100644 --- a/backups/app/specs/specs.py +++ b/backups/app/specs/specs.py @@ -25,7 +25,8 @@ class Spec: raise NotImplementedError() def remove_redundant(self): - tarballs = self.destination.glob('*.tar.gz') + tarballs = sorted(self.destination.glob('*.tar.gz'), + key=os.path.getmtime, reverse=True) if len(tarballs) >= self.limit: for path in tarballs[self.limit - 1:]: