mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
Add healthcheck endpoint to rpc services (#10718)
* Add healthcheck endpoint to rpc services * Trailing whitespace ding
This commit is contained in:
@@ -67,6 +67,9 @@ class RpcClient:
|
||||
async def stop_node(self) -> Dict:
|
||||
return await self.fetch("stop_node", {})
|
||||
|
||||
async def healthz(self) -> Dict:
|
||||
return await self.fetch("healthz", {})
|
||||
|
||||
def close(self):
|
||||
self.closing_task = asyncio.create_task(self.session.close())
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ class RpcServer:
|
||||
"/close_connection": self.close_connection,
|
||||
"/stop_node": self.stop_node,
|
||||
"/get_routes": self._get_routes,
|
||||
"/healthz": self.healthz,
|
||||
}
|
||||
|
||||
async def _get_routes(self, request: Dict) -> Dict:
|
||||
@@ -183,6 +184,11 @@ class RpcServer:
|
||||
self.stop_cb()
|
||||
return {}
|
||||
|
||||
async def healthz(self, request: Dict) -> Dict:
|
||||
return {
|
||||
"success": "true",
|
||||
}
|
||||
|
||||
async def ws_api(self, message):
|
||||
"""
|
||||
This function gets called when new message is received via websocket.
|
||||
|
||||
Reference in New Issue
Block a user