Explorar el Código

fix(account): shutdown 也加 try-except 防多 router 重复关闭

alphah hace 1 semana
padre
commit
702ca42b3c
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6 3
      backend/app/plugin/module_payment/account/controller.py

+ 6 - 3
backend/app/plugin/module_payment/account/controller.py

@@ -617,6 +617,9 @@ async def start_retry_scheduler():
 
 @AccountRouter.on_event("shutdown")
 async def stop_retry_scheduler():
-    if scheduler.running:
-        scheduler.shutdown(wait=False)
-        log.info("[重试任务] 定时任务已停止")
+    try:
+        if scheduler.running:
+            scheduler.shutdown(wait=False)
+            log.info("[重试任务] 定时任务已停止")
+    except Exception:
+        pass