fix: 凭据刷新线程出错后继续运行并留下日志
This commit is contained in:
@@ -555,8 +555,15 @@ def start_credential_refresh() -> _RefreshGate:
|
|||||||
_gate = gate
|
_gate = gate
|
||||||
|
|
||||||
def loop() -> None:
|
def loop() -> None:
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger("euniv.service")
|
||||||
while True:
|
while True:
|
||||||
seconds = _refresh_interval_seconds()
|
try:
|
||||||
|
seconds = _refresh_interval_seconds()
|
||||||
|
except Exception:
|
||||||
|
logger.exception("读取凭据刷新间隔失败")
|
||||||
|
seconds = 30 * 60
|
||||||
reason = gate.wait(seconds)
|
reason = gate.wait(seconds)
|
||||||
if reason == "stop":
|
if reason == "stop":
|
||||||
return
|
return
|
||||||
@@ -565,7 +572,7 @@ def start_credential_refresh() -> _RefreshGate:
|
|||||||
try:
|
try:
|
||||||
refresh_stored_credentials()
|
refresh_stored_credentials()
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
logger.exception("凭据刷新失败")
|
||||||
|
|
||||||
threading.Thread(target=loop, name="euniv-credential-refresh", daemon=True).start()
|
threading.Thread(target=loop, name="euniv-credential-refresh", daemon=True).start()
|
||||||
return gate
|
return gate
|
||||||
|
|||||||
Reference in New Issue
Block a user