Add healthcheck endpoint to rpc services (#10718)

* Add healthcheck endpoint to rpc services

* Trailing whitespace ding
This commit is contained in:
Brandon Butler
2022-03-17 08:45:48 -07:00
committed by GitHub
parent 82e8b7dea5
commit 6c5d7e7e89
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -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())
+6
View File
@@ -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.