Skip to content

Commit

Permalink
better
Browse files Browse the repository at this point in the history
  • Loading branch information
munakoiso committed Jul 29, 2024
1 parent 6b14c77 commit 837b27a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,7 @@ def _attach_to_primary(self, new_primary, limit):
return True

def _handle_slots(self):
need_slots = self.config.getboolean('global', 'use_replication_slots')
if not need_slots:
if not self.config.getboolean('global', 'use_replication_slots'):
return

my_hostname = helpers.get_hostname()
Expand Down Expand Up @@ -1143,8 +1142,7 @@ def _get_db_state(self):
return state

def _acquire_replication_source_lock(self, primary):
need_slots = self.config.getboolean('global', 'use_replication_slots')
if not need_slots:
if not self.config.getboolean('global', 'use_replication_slots'):
return
# We need to drop the slot in the old primary.
# But we don't know who the primary was (probably there are many of them).
Expand Down Expand Up @@ -1283,8 +1281,7 @@ def _promote(self):
return True

def _promote_handle_slots(self):
need_slots = self.config.getboolean('global', 'use_replication_slots')
if need_slots:
if self.config.getboolean('global', 'use_replication_slots'):
if not self.zk.write(self.zk.FAILOVER_INFO_PATH, 'creating_slots'):
logging.warning('Could not write failover state to ZK.')

Expand Down

0 comments on commit 837b27a

Please sign in to comment.