File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ dependencies = [
1616 " psycopg[binary]>=3.1.18" ,
1717 " websockets>=16.0" ,
1818 " path>=17.1.1" ,
19+ " httpx>=0.28.1" ,
1920]
2021
2122[project .optional-dependencies ]
Original file line number Diff line number Diff line change @@ -358,6 +358,28 @@ def _init_session(self) -> bool:
358358 self ._log (f"初始化会话失败: { e } " , "error" )
359359 return False
360360
361+ def close (self ):
362+ """关闭注册流程占用的资源"""
363+ if self .session :
364+ try :
365+ self .session .close ()
366+ except Exception as e :
367+ self ._log (f"关闭注册会话失败: { e } " , "warning" )
368+ finally :
369+ self .session = None
370+
371+ try :
372+ self .http_client .close ()
373+ except Exception as e :
374+ self ._log (f"关闭 HTTP 客户端失败: { e } " , "warning" )
375+
376+ close_email_service = getattr (self .email_service , "close" , None )
377+ if callable (close_email_service ):
378+ try :
379+ close_email_service ()
380+ except Exception as e :
381+ self ._log (f"关闭邮箱服务失败: { e } " , "warning" )
382+
361383 def _get_device_id (self ) -> Optional [str ]:
362384 """获取 Device ID"""
363385 if not self .oauth_start :
You can’t perform that action at this time.
0 commit comments