From 384a2a4d8f579d5151cb5bb2d03f96644279275d Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 27 Jul 2023 13:38:24 +0200 Subject: [PATCH] Avoid unnecessary updates of /status key (#2782) When we don't have permanent logical slots Patroni was updating the `/status` on every heart-beat loop even when LSN on the primary isn't moving forward. The issue was introduced in the #2485 --- patroni/dcs/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patroni/dcs/__init__.py b/patroni/dcs/__init__.py index f07ce6cd..29a4d766 100644 --- a/patroni/dcs/__init__.py +++ b/patroni/dcs/__init__.py @@ -1033,7 +1033,9 @@ class AbstractDCS(abc.ABC): raise self._last_seen = int(time.time()) - self._last_status = {self._OPTIME: cluster.last_lsn, 'slots': cluster.slots} + self._last_status = {self._OPTIME: cluster.last_lsn} + if cluster.slots: + self._last_status['slots'] = cluster.slots self._last_failsafe = cluster.failsafe with self._cluster_thread_lock: