From 3937a8d4fc17b70748d35d8710c1cf9af30e9346 Mon Sep 17 00:00:00 2001 From: anikin-aa Date: Mon, 26 Aug 2019 12:18:13 +0300 Subject: [PATCH] Fix status code for GET /replica, when replica is starting (#1152) Close #772, #1128 --- patroni/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patroni/api.py b/patroni/api.py index 894064f5..8caec153 100644 --- a/patroni/api.py +++ b/patroni/api.py @@ -101,7 +101,8 @@ class RestApiHandler(BaseHTTPRequestHandler): else: primary_status_code = 200 if patroni.ha.is_leader() else 503 - replica_status_code = 200 if not patroni.noloadbalance and response.get('role') == 'replica' else 503 + replica_status_code = 200 if not patroni.noloadbalance and \ + response.get('role') == 'replica' and response.get('state') == 'running' else 503 status_code = 503 if patroni.ha.is_standby_cluster() and ('standby_leader' in path or 'standby-leader' in path):