Skip to content

Commit

Permalink
clear the decision queue
Browse files Browse the repository at this point in the history
to make sure consumer threads is not looping unnecessarily. This can
happen if the node is loaded and consumer thread has remain unscheduled
  • Loading branch information
sjamgade committed Mar 16, 2021
1 parent f63b7ec commit fd0c827
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pglookout/pglookout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd0c827

Please sign in to comment.