@@ -85,7 +85,7 @@ async fn check_node_health(
8585 let guard = cluster_data. nodes . read ( ) . await ;
8686 let mut potential_nodes: Vec < String > = guard
8787 . iter ( )
88- . filter ( |( node, info) | * node != current_addr && ( info. status == NodeStatus :: Active || info. status == NodeStatus :: Suspect ) )
88+ . filter ( |( node, info) | * node != current_addr && ( info. status == NodeStatus :: Active || info. status == NodeStatus :: Suspect || info . status == NodeStatus :: Down ) )
8989 . map ( |( node, _) | node. clone ( ) )
9090 . collect ( ) ;
9191
@@ -94,7 +94,7 @@ async fn check_node_health(
9494 potential_nodes. into_iter ( ) . take ( 3 ) . collect :: < Vec < _ > > ( )
9595 } ;
9696
97- let timeout_threshold = ( interval_sec as u128 ) * 2000 ;
97+ let timeout_threshold = ( interval_sec as u128 ) * 5000 ;
9898
9999 for target in nodes_to_check {
100100 let url = build_url ( & target, "heartbeat" ) ;
@@ -278,7 +278,7 @@ pub async fn update_membership(
278278 Ok ( v) => v,
279279 Err ( _) => return HttpResponse :: BadRequest ( ) . finish ( ) ,
280280 } ;
281- let mut updated = false ;
281+
282282
283283 for ( node, info) in incoming. into_iter ( ) {
284284 // 2. Input Validation (ensure it's not empty and has no spaces)
@@ -296,21 +296,18 @@ pub async fn update_membership(
296296 }
297297
298298 local_guard. insert ( node, info) ;
299- updated = true ;
299+
300300 continue ;
301301 }
302302
303303 // For existing nodes, only update if the incoming data is newer
304304 let existing = local_guard. get ( & node) . unwrap ( ) ;
305305 if info. last_heartbeat > existing. last_heartbeat {
306306 local_guard. insert ( node, info) ;
307- updated = true ;
307+
308308 }
309309 }
310310
311- if updated {
312- println ! ( "Updated membership: {:?}" , * local_guard) ;
313- }
314311
315312 HttpResponse :: Ok ( ) . finish ( )
316313}
0 commit comments