Update notification service

This commit is contained in:
MacRimi
2026-03-27 20:42:03 +01:00
parent 976f23a90e
commit 4cc1147579
4 changed files with 56 additions and 54 deletions

View File

@@ -55,9 +55,9 @@ class HealthPersistence:
def _get_conn(self) -> sqlite3.Connection:
"""Get a SQLite connection with timeout and WAL mode for safe concurrency."""
conn = sqlite3.connect(str(self.db_path), timeout=10)
conn = sqlite3.connect(str(self.db_path), timeout=30)
conn.execute('PRAGMA journal_mode=WAL')
conn.execute('PRAGMA busy_timeout=5000')
conn.execute('PRAGMA busy_timeout=10000')
return conn
@contextmanager
@@ -1327,7 +1327,7 @@ class HealthPersistence:
# ────────────────────────────────────────────────────────────────
# Disk Observations API
# ──────────────────────<EFBFBD><EFBFBD><EFBFBD>─────────────────────────────────────────
# ───────────────────────────────────────────────────────────────
def register_disk(self, device_name: str, serial: Optional[str] = None,
model: Optional[str] = None, size_bytes: Optional[int] = None):
@@ -1340,6 +1340,7 @@ class HealthPersistence:
under 'ata8' and we now know the real block device is 'sdh' with
serial 'WX72...', update the old entry so observations are linked.
"""
with self._db_lock:
now = datetime.now().isoformat()
try:
conn = self._get_conn()

View File

@@ -251,7 +251,7 @@ class TelegramChannel(NotificationChannel):
.replace('>', '&gt;'))
# ─── Gotify ─────────────────────────────────────────────────────
# ─── Gotify ───────────────────────────────────<EFBFBD><EFBFBD>──────────────────
class GotifyChannel(NotificationChannel):
"""Gotify push notification channel with priority mapping."""

View File

@@ -197,7 +197,7 @@ def capture_journal_context(keywords: list, lines: int = 30,
return ""
# ─── Journal Watcher (Real-time) ────────────────────────────────
# ─── Journal Watcher (Real-time) ───────────────<EFBFBD><EFBFBD>─────────────────
class JournalWatcher:
"""Watches journald in real-time for critical system events.

View File

@@ -1615,6 +1615,7 @@ class NotificationManager:
'ai_openai_base_url': self._config.get('ai_openai_base_url', ''),
'ai_prompt_mode': self._config.get('ai_prompt_mode', 'default'),
'ai_custom_prompt': self._config.get('ai_custom_prompt', ''),
'ai_allow_suggestions': self._config.get('ai_allow_suggestions', 'false') == 'true',
'ai_detail_levels': ai_detail_levels,
'hostname': self._config.get('hostname', ''),
'webhook_secret': self._config.get('webhook_secret', ''),