This repository was archived by the owner on Jan 27, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,19 @@ impl DiscoveryMonitor {
338338 node. ip_address = discovery_node. node . ip_address . clone ( ) ;
339339 let _ = self . store_context . node_store . add_node ( node. clone ( ) ) . await ;
340340 }
341+ if existing_node. location . is_none ( ) && discovery_node. location . is_some ( ) {
342+ info ! (
343+ "Node {} location changed from None to {:?}" ,
344+ node_address, discovery_node. location
345+ ) ;
346+ if let Some ( location) = & discovery_node. location {
347+ let _ = self
348+ . store_context
349+ . node_store
350+ . update_node_location ( & node_address, location)
351+ . await ;
352+ }
353+ }
341354
342355 if existing_node. status == NodeStatus :: Dead {
343356 if let ( Some ( last_change) , Some ( last_updated) ) = (
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use log::info;
77use redis:: AsyncCommands ;
88use redis:: Value ;
99use shared:: models:: heartbeat:: TaskDetails ;
10+ use shared:: models:: node:: NodeLocation ;
1011use shared:: models:: task:: TaskState ;
1112use std:: sync:: Arc ;
1213
@@ -145,6 +146,21 @@ impl NodeStore {
145146 Ok ( ( ) )
146147 }
147148
149+ pub async fn update_node_location (
150+ & self ,
151+ node_address : & Address ,
152+ location : & NodeLocation ,
153+ ) -> Result < ( ) > {
154+ let mut con = self . redis . client . get_multiplexed_async_connection ( ) . await ?;
155+ let node_key: String = format ! ( "{}:{}" , ORCHESTRATOR_BASE_KEY , node_address) ;
156+ let node_string: String = con. get ( & node_key) . await ?;
157+ let mut node: OrchestratorNode = serde_json:: from_str ( & node_string) ?;
158+ node. location = Some ( location. clone ( ) ) ;
159+ let node_string = node. to_string ( ) ;
160+ let _: ( ) = con. set ( & node_key, node_string) . await ?;
161+ Ok ( ( ) )
162+ }
163+
148164 pub async fn update_node_p2p_id ( & self , node_address : & Address , p2p_id : & str ) -> Result < ( ) > {
149165 let mut con = self . redis . client . get_multiplexed_async_connection ( ) . await ?;
150166 let node_key: String = format ! ( "{}:{}" , ORCHESTRATOR_BASE_KEY , node_address) ;
You can’t perform that action at this time.
0 commit comments