fix: 凭据刷新线程出错后继续运行并留下日志

This commit is contained in:
2026-11-16 02:56:16 +08:00
parent d97843079e
commit c9f70ad455
+9 -2
View File
@@ -555,8 +555,15 @@ def start_credential_refresh() -> _RefreshGate:
_gate = gate
def loop() -> None:
import logging
logger = logging.getLogger("euniv.service")
while True:
seconds = _refresh_interval_seconds()
try:
seconds = _refresh_interval_seconds()
except Exception:
logger.exception("读取凭据刷新间隔失败")
seconds = 30 * 60
reason = gate.wait(seconds)
if reason == "stop":
return
@@ -565,7 +572,7 @@ def start_credential_refresh() -> _RefreshGate:
try:
refresh_stored_credentials()
except Exception:
continue
logger.exception("凭据刷新失败")
threading.Thread(target=loop, name="euniv-credential-refresh", daemon=True).start()
return gate