fix: only log WAN IP error when all echoip URLs fail

This commit is contained in:
Aiden McClelland
2026-03-25 13:24:18 -06:00
parent fd0dc9a5b8
commit bb2e69299e

View File

@@ -1311,6 +1311,7 @@ async fn poll_ip_info(
crate::db::model::public::default_echoip_urls() crate::db::model::public::default_echoip_urls()
}; };
let mut wan_ip = None; let mut wan_ip = None;
let mut err = None;
for echoip_url in echoip_urls { for echoip_url in echoip_urls {
if echoip_ratelimit_state if echoip_ratelimit_state
.get(&echoip_url) .get(&echoip_url)
@@ -1326,15 +1327,7 @@ async fn poll_ip_info(
wan_ip = a; wan_ip = a;
} }
Err(e) => { Err(e) => {
tracing::error!( err = Some(e);
"{}",
t!(
"net.gateway.failed-to-determine-wan-ip",
iface = iface.to_string(),
error = e.to_string()
)
);
tracing::debug!("{e:?}");
} }
}; };
echoip_ratelimit_state.insert(echoip_url, Instant::now()); echoip_ratelimit_state.insert(echoip_url, Instant::now());
@@ -1343,6 +1336,19 @@ async fn poll_ip_info(
} }
}; };
} }
if wan_ip.is_none()
&& let Some(e) = err
{
tracing::error!(
"{}",
t!(
"net.gateway.failed-to-determine-wan-ip",
iface = iface.to_string(),
error = e.to_string()
)
);
tracing::debug!("{e:?}");
}
let mut ip_info = IpInfo { let mut ip_info = IpInfo {
name: name.clone(), name: name.clone(),
scope_id, scope_id,