Add better logging on tz failures

This commit is contained in:
Andrew 2023-03-09 11:09:58 -05:00
parent 12fc3be00d
commit 6fa1b02888
2 changed files with 4 additions and 2 deletions

View File

@ -134,9 +134,10 @@ class ServerInstance:
self.last_backup_failed = False
try:
self.tz = get_localzone()
except ZoneInfoNotFoundError:
except ZoneInfoNotFoundError as e:
logger.error(
"Could not capture time zone from system. Falling back to Europe/London"
f" error: {e}"
)
self.tz = ZoneInfo("Europe/London")
self.server_scheduler = BackgroundScheduler(timezone=str(self.tz))

View File

@ -47,9 +47,10 @@ class TasksManager:
self.tornado: Webserver = Webserver(helper, controller, self)
try:
self.tz = get_localzone()
except ZoneInfoNotFoundError:
except ZoneInfoNotFoundError as e:
logger.error(
"Could not capture time zone from system. Falling back to Europe/London"
f" error: {e}"
)
self.tz = "Europe/London"
self.scheduler = BackgroundScheduler(timezone=str(self.tz))