File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 30
30
from starlette import status
31
31
from starlette .exceptions import HTTPException as StarletteHTTPException
32
32
33
+ from app .database import DBAsyncSession
33
34
from app .exceptions import (
34
35
AuthorizationError ,
35
36
BadRequestError ,
36
37
ContractRevertError ,
37
38
ServiceUnavailableError ,
38
39
)
39
- from app .log import output_access_log
40
+ from app .log import LOG , output_access_log
40
41
from app .routers .issuer import (
41
42
account ,
42
43
bond ,
@@ -137,7 +138,13 @@ async def api_call_handler(request: Request, call_next):
137
138
138
139
139
140
@app .get ("/" , tags = ["root" ])
140
- async def root ():
141
+ async def root (db : DBAsyncSession ):
142
+ try :
143
+ # Check DB Connection
144
+ await db .connection ()
145
+ except Exception as err :
146
+ LOG .exception ("error" )
147
+ raise ServiceUnavailableError (err )
141
148
libc .malloc_trim (0 )
142
149
return {"server" : SERVER_NAME }
143
150
You can’t perform that action at this time.
0 commit comments