Make the admin database counters failsafe

This commit is contained in:
Gregoo 2025-01-23 08:59:40 +01:00
parent 3223dd0edc
commit 5ea9240f34

View File

@ -124,10 +124,14 @@ class BrickSQL(object):
# Count the database records
def count_records(self) -> list[BrickCounter]:
for counter in COUNTERS:
record = self.fetchone('schema/count', table=counter.table)
# Failsafe this one
try:
record = self.fetchone('schema/count', table=counter.table)
if record is not None:
counter.count = record['count']
if record is not None:
counter.count = record['count']
except Exception:
pass
return COUNTERS