File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed
Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -731,28 +731,29 @@ async def get_healthz(
731731
732732 # check credentials
733733 if credentials is None :
734- # no credentials were set
735- check_db_connection ()
734+ # no credentials were set
735+ check_db_connection ()
736736 elif credentials .username == settings .hc_user and credentials .password == settings .hc_password :
737- # healthz user
738- check_db_connection (authorized = True )
737+ # healthz user
738+ check_db_connection (authorized = True )
739739 else :
740- # unauthorized user
741- check_db_connection ()
740+ # unauthorized user
741+ check_db_connection ()
742742
743743 return {"message" : "OK" }
744744
745+
745746def check_db_connection (authorized : bool = False ):
746- # check database connection
747- try :
748- mk_conn (settings = settings )
749- except psycopg2 .OperationalError as e :
750- if authorized :
751- # authorized user
752- raise HTTPException (status_code = 500 ,
753- detail = "Database Connection Error. " + e .args [0 ].capitalize ())
754- else :
755- raise HTTPException (status_code = 500 , detail = "Internal Server Error" )
747+ # check database connection
748+ try :
749+ mk_conn (settings = settings )
750+ except psycopg2 .OperationalError as e :
751+ if authorized :
752+ # authorized user
753+ raise HTTPException (status_code = 500 ,
754+ detail = "Database Connection Error. " + e .args [0 ].capitalize ())
755+ else :
756+ raise HTTPException (status_code = 500 , detail = "Internal Server Error" )
756757
757758
758759def pick_filter (results , subject , scope ):
You can’t perform that action at this time.
0 commit comments