minor fix

This commit is contained in:
Aryan Singh committed 2026-09-27 22:26:46 -05:00
1 parent 3b5e358cf3
commit cd52b7ddbe
1 file changed
+22 -10
+22 -10
View File
@@ -520,19 +520,31 @@ def worker_5():
#THREAD 5 HELPERS #THREAD 5 HELPERS
def cmd_list_mem(): def cmd_list_mem():
with members_list_lock: with members_list_lock:
for member_id, member_data in members_list.items(): cluster_state = [
if member_data["state"] == "failed": (
continue m_id,
log(f"{member_id} state = {member_data['state']}, heartbeat = {member_data['heart_beat']}, incarnation = {member_data['incarnation_counter']}") m_data["state"],
m_data["heart_beat"],
m_data["incarnation_counter"],
)
for m_id, m_data in members_list.items()
if m_data["state"] != "failed"
]
for m_id, state, hb, inc in cluster_state:
log(f"{m_id} state = {state}, heartbeat = {hb}, incarnation = {inc}")
def cmd_display_suspects(): def cmd_display_suspects():
with suspect_history_lock: with suspect_history_lock:
if not suspect_history: history_snapshot = list(suspect_history)
log("No suspects recorded.")
else: if not history_snapshot:
log("Suspect history:") log("No suspects recorded.")
for member_id, timestamp in suspect_history: else:
log(f"{member_id} suspected at {timestamp}") log("Suspect history:")
for member_id, timestamp in history_snapshot:
log(f"{member_id} suspected at {timestamp}")
# THREAD 6 - Display membership list in a pretty format # THREAD 6 - Display membership list in a pretty format