fixed IpAddress matching Payload on Server
This commit is contained in:
@@ -159,7 +159,14 @@ async fn get_server_id_by_ip(base_url: &str, ip: &str) -> Result<(i32, String),
|
||||
println!("Attempting to fetch server ID for IP {}...", ip);
|
||||
match client.get(&url).send().await {
|
||||
Ok(resp) if resp.status().is_success() => {
|
||||
let id_resp: IdResponse = resp.json().await?;
|
||||
let text = resp.text().await?;
|
||||
println!("Raw response: {}", text); // Debug output
|
||||
|
||||
let id_resp: IdResponse = serde_json::from_str(&text).map_err(|e| {
|
||||
println!("Failed to parse response: {}", e);
|
||||
e
|
||||
})?;
|
||||
|
||||
println!(
|
||||
"✅ Received ID {} for IP {}",
|
||||
id_resp.id, id_resp.ip_address
|
||||
@@ -168,21 +175,23 @@ async fn get_server_id_by_ip(base_url: &str, ip: &str) -> Result<(i32, String),
|
||||
}
|
||||
Ok(resp) if resp.status() == StatusCode::NOT_FOUND => {
|
||||
println!(
|
||||
"🔄 Server with IP {} not found in database (will retry in 30 seconds)",
|
||||
"❌ Server with IP {} not found in database (will retry in 30 seconds)",
|
||||
ip
|
||||
);
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
sleep(Duration::from_secs(10)).await;
|
||||
}
|
||||
Ok(resp) => {
|
||||
//let text = resp.text().await?;
|
||||
println!(
|
||||
"⚠️ Server responded with status: {} (will retry in 30 seconds)",
|
||||
resp.status()
|
||||
"⚠️ Server responded with status: {} - {}",
|
||||
resp.status(),
|
||||
resp.text().await?
|
||||
);
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
sleep(Duration::from_secs(10)).await;
|
||||
}
|
||||
Err(err) => {
|
||||
println!("⚠️ Request failed: {} (will retry in 30 seconds)", err);
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
sleep(Duration::from_secs(10)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user