Skip to content

Commit 4129d24

Browse files
author
avandras
committed
Replace missing operator for python < 3.9
1 parent dbc41ec commit 4129d24

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

patroni/ctl.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,11 +1754,13 @@ def get_cluster_service_info(cluster: Dict[str, Any]) -> List[str]:
17541754
# the member dicts to find it
17551755
r = {'latest_end_lsn': str, 'lag_to_primary': int}
17561756
if 'members' in cluster:
1757-
r = reduce(ior, cluster['members'], {})
1758-
if 'latest_end_lsn' in r and 'lag_to_primary' in r:
1759-
lag_to_primary = r.get('lag_to_primary')
1757+
for m in cluster['members']:
1758+
if 'latest_end_lsn' in m and 'lag_to_primary' in m:
1759+
r.update(m)
1760+
if r['latest_end_lsn'] and r['lag_to_primary']:
1761+
lag_to_primary = r['lag_to_primary']
17601762
lag_to_primary = round(lag_to_primary / 1024 / 1024) if isinstance(lag_to_primary, int) \
1761-
else '' if lag_to_primary == 'unknown' else lag_to_primary
1763+
else lag_to_primary
17621764
if r['latest_end_lsn'] and lag_to_primary:
17631765
info = (f"The latest known LSN of the primary instance is {r['latest_end_lsn']}, "
17641766
f"the replication lag is {lag_to_primary} MB")

0 commit comments

Comments
 (0)