mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-29 05:18:47 +00:00
feat(core): Upgrade pydantic to 2.x (#1428)
This commit is contained in:
@@ -297,8 +297,8 @@ class SystemApp(LifeCycle):
|
||||
if not self.app:
|
||||
self._register_exit_handler()
|
||||
return
|
||||
from dbgpt.util.fastapi import register_event_handler
|
||||
|
||||
@self.app.on_event("startup")
|
||||
async def startup_event():
|
||||
"""ASGI app startup event handler."""
|
||||
|
||||
@@ -312,12 +312,14 @@ class SystemApp(LifeCycle):
|
||||
asyncio.create_task(_startup_func())
|
||||
self.after_start()
|
||||
|
||||
@self.app.on_event("shutdown")
|
||||
async def shutdown_event():
|
||||
"""ASGI app shutdown event handler."""
|
||||
await self.async_before_stop()
|
||||
self.before_stop()
|
||||
|
||||
register_event_handler(self.app, "startup", startup_event)
|
||||
register_event_handler(self.app, "shutdown", shutdown_event)
|
||||
|
||||
def _register_exit_handler(self):
|
||||
"""Register an exit handler to stop the system app."""
|
||||
atexit.register(self.before_stop)
|
||||
|
Reference in New Issue
Block a user