From fd0c827378664fb888c2d4518854b5091c68ac9c Mon Sep 17 00:00:00 2001 From: sjamgade Date: Tue, 16 Mar 2021 09:21:57 +0100 Subject: [PATCH] clear the decision queue to make sure consumer threads is not looping unnecessarily. This can happen if the node is loaded and consumer thread has remain unscheduled --- pglookout/pglookout.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pglookout/pglookout.py b/pglookout/pglookout.py index ea5692c..2bf1075 100755 --- a/pglookout/pglookout.py +++ b/pglookout/pglookout.py @@ -649,6 +649,12 @@ def main_loop(self): self.stats.unexpected_exception(ex, where="main_loop_writer_cluster_state") try: self.failover_decision_queue.get(timeout=float(self.config.get("replication_state_check_interval", 5.0))) + q = self.failover_decision_queue + while not q.empty(): + try: + q.get(False) + except Empty: + continue self.log.info("Immediate failover check completed") except Empty: pass