From 75e79e306877f5c76316d08e4b0811b115330b62 Mon Sep 17 00:00:00 2001 From: Rui Almeida Date: Tue, 30 Aug 2022 14:20:43 +0100 Subject: [PATCH 1/2] Set matching cache status http code --- services/ui_backend_service/api/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/ui_backend_service/api/admin.py b/services/ui_backend_service/api/admin.py index 3faffc23..c5a46842 100644 --- a/services/ui_backend_service/api/admin.py +++ b/services/ui_backend_service/api/admin.py @@ -258,7 +258,8 @@ async def status(self, request): "workers": worker_list } - return web_response(status=200, body={ + status = 200 if all([x["is_alive"] for x in cache_status.values()]) else 500 + return web_response(status=status, body={ "cache": cache_status }) From 0cc23cb7e650980f95670c3f56ced36285dcdb08 Mon Sep 17 00:00:00 2001 From: Rui Almeida Date: Tue, 30 Aug 2022 17:00:26 +0100 Subject: [PATCH 2/2] Update admin.py --- services/ui_backend_service/api/admin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/ui_backend_service/api/admin.py b/services/ui_backend_service/api/admin.py index c5a46842..f56c3afc 100644 --- a/services/ui_backend_service/api/admin.py +++ b/services/ui_backend_service/api/admin.py @@ -186,6 +186,8 @@ async def status(self, request): description: Return system status information, such as cache "405": description: invalid HTTP Method + "500": + description: cache is unhealthy """ cache_status = {} @@ -258,8 +260,8 @@ async def status(self, request): "workers": worker_list } - status = 200 if all([x["is_alive"] for x in cache_status.values()]) else 500 - return web_response(status=status, body={ + status_code = 200 if all([store["is_alive"] for store in cache_status.values()]) else 500 + return web_response(status=status_code, body={ "cache": cache_status })