From 36cc7825b386966b97af0d96343cca30bb81bf1c Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sun, 27 Sep 2026 20:20:36 -0500 Subject: [PATCH] Update peer.py --- MP2/peer.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MP2/peer.py b/MP2/peer.py index d6b8fc2..ea24cfb 100644 --- a/MP2/peer.py +++ b/MP2/peer.py @@ -14,12 +14,11 @@ def _machine_index(): return int(idx) return None -log_file = open(f"machine.{_machine_index()}.log", "a") +log_file = open(f"machine.{_machine_index()}.log", "w") log_lock = threading.Lock() def log(message): timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3] with log_lock: - print(f"[{timestamp}] {message}") log_file.write(f"[{timestamp}] {message}\n") log_file.flush() @@ -32,13 +31,13 @@ GLOBAL_PORT = 8989 MY_IP = socket.gethostbyname(socket.gethostname()) HEARTBEAT_INTERVAL = 0.25 -GOSSIP_INTERVAL = 0.15 +GOSSIP_INTERVAL = 0.35 JOIN_RETRY_INTERVAL = 1.0 -GOSSIP_FANOUT = 1 +GOSSIP_FANOUT = 2 GOSSIP_FAILURE_TIMEOUT = 2.8 -GOSSIP_S_SUSPECT_TIMEOUT = 1 -GOSSIP_S_TIMEOUT_SUSPECT = 1.8 +GOSSIP_S_SUSPECT_TIMEOUT = 1.2 +GOSSIP_S_TIMEOUT_SUSPECT = 1.6 GOSSIP_FAILURE_TIMEOUT_CLEANUP = 10.0