Skip to content

Commit

Permalink
fix: refresh metrics with no backup
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampouille committed Sep 13, 2024
1 parent 28902a6 commit b86b40f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pg253/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def _readRemoteBackup(self):
def refreshMetrics(self):
for database in Remote.BACKUPS:
(self.first_backup.labels(database)
.set(min(Remote.BACKUPS[database])[0].timestamp()))
.set(min(Remote.BACKUPS[database], default=0)[0].timestamp()))
(self.last_backup.labels(database)
.set(max(Remote.BACKUPS[database])[0].timestamp()))
.set(max(Remote.BACKUPS[database], default=0)[0].timestamp()))

def removeBackup(self, database, date, size):
self.backups.remove(database, date.strftime('%Y%m%d-%H%M'), size)
Expand Down

0 comments on commit b86b40f

Please sign in to comment.