Update public source

This commit is contained in:
2026-10-11 05:47:23 +03:00
parent d035b68f6f
commit d4548c0d46
2 changed files with 28 additions and 8 deletions
+25 -5
View File
@@ -10,7 +10,7 @@
по всему проекту.
"""
from pathlib import Path
from functools import lru_cache
import yaml
@@ -55,10 +55,30 @@ RECENT_SESSIONS_LIMIT = REPORTS_CONFIG.get(
10
)
TIMEZONE = CONFIG.get(
"timezone",
"Europe/Moscow"
)
TIMEZONE = CONFIG.get("timezone", "Europe/Moscow")
@lru_cache(maxsize=1)
def _load_timezone(mtime_ns, size):
with CONFIG_FILE.open("r", encoding="utf-8") as fp:
config = yaml.safe_load(fp) or {}
timezone_name = config.get("timezone", "Europe/Moscow")
if not isinstance(timezone_name, str) or not timezone_name:
return "Europe/Moscow"
return timezone_name
def get_timezone():
try:
stat = CONFIG_FILE.stat()
except OSError:
return "Europe/Moscow"
try:
return _load_timezone(stat.st_mtime_ns, stat.st_size)
except (OSError, yaml.YAMLError):
return TIMEZONE
# ============================================================
# Каталог отчёта