ソースを参照

fix: improve error message formatting and logging in background loop initialization

Manuel 6 ヶ月 前
親
コミット
78fc4f99dc
1 ファイル変更、6 行追加、3 行削除
  1. 6 3
      services/notifications/telegram_integration.py

+ 6 - 3
services/notifications/telegram_integration.py

@@ -71,10 +71,14 @@ def _get_background_loop() -> asyncio.AbstractEventLoop:
         deadline = time.monotonic() + 5.0
         while not _bg_loop.is_running():
             if time.monotonic() > deadline:
-                raise RuntimeError("Telegram background event loop did not start in time")
+                raise RuntimeError(
+                    "Telegram background event loop did not start in time"
+                )
             time.sleep(0.01)
 
-        logger.debug("Telegram background event loop started (thread: telegram-event-loop)")
+        logger.debug(
+            "Telegram background event loop started (thread: telegram-event-loop)"
+        )
         return _bg_loop
 
 
@@ -101,7 +105,6 @@ def async_to_sync(async_func: Callable) -> Callable:
     return wrapper
 
 
-
 def initialize_telegram_service() -> bool:
     """
     Initialize or reinitialize the Telegram service from DB configuration.