Skip to content

Commit

Permalink
Remote discovery: fix bug where remote discovery never resyncs remote…
Browse files Browse the repository at this point in the history
… CGWs

Signed-off-by: Oleksandr Mazur <[email protected]>
  • Loading branch information
Cahb committed Sep 27, 2024
1 parent 4f0c20b commit c7d01f8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/cgw_remote_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,25 +996,26 @@ impl CGWRemoteDiscovery {
// try to use internal cache first
if let Some(cl) = self.remote_cgws_map.read().await.get(&shard_id) {
if let Err(_e) = cl.client.relay_request_stream(stream).await {
error!(
"Failed to relay message. CGW{} seems to be unreachable at [{}:{}]",
warn!(
"Failed to relay message. CGW{} seems to be unreachable at [{}:{}], will try to resync map and try again",
shard_id, cl.shard.server_host, cl.shard.server_port
);
} else {
return Ok(());
}

return Ok(());
}

// then try to use redis
let _ = self.sync_remote_cgw_map().await;
if let Some(cl) = self.remote_cgws_map.read().await.get(&shard_id) {
if let Err(_e) = cl.client.relay_request_stream(stream).await {
error!(
"Failed to relay message. CGW{} seems to be unreachable at [{}:{}]",
"Failed to relay message event after resync. CGW{} seems to be unreachable at [{}:{}]",
shard_id, cl.shard.server_host, cl.shard.server_port
);
} else {
return Ok(());
}
return Ok(());
}

error!("No suitable CGW instance #{shard_id} was discovered, cannot relay msg");
Expand Down

0 comments on commit c7d01f8

Please sign in to comment.