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);
|
println!("Attempting to fetch server ID for IP {}...", ip);
|
||||||
match client.get(&url).send().await {
|
match client.get(&url).send().await {
|
||||||
Ok(resp) if resp.status().is_success() => {
|
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!(
|
println!(
|
||||||
"✅ Received ID {} for IP {}",
|
"✅ Received ID {} for IP {}",
|
||||||
id_resp.id, id_resp.ip_address
|
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 => {
|
Ok(resp) if resp.status() == StatusCode::NOT_FOUND => {
|
||||||
println!(
|
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
|
ip
|
||||||
);
|
);
|
||||||
sleep(Duration::from_secs(30)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
|
//let text = resp.text().await?;
|
||||||
println!(
|
println!(
|
||||||
"⚠️ Server responded with status: {} (will retry in 30 seconds)",
|
"⚠️ Server responded with status: {} - {}",
|
||||||
resp.status()
|
resp.status(),
|
||||||
|
resp.text().await?
|
||||||
);
|
);
|
||||||
sleep(Duration::from_secs(30)).await;
|
sleep(Duration::from_secs(10)).await;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("⚠️ Request failed: {} (will retry in 30 seconds)", 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