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,6 +1327,18 @@ async fn poll_ip_info(
wan_ip = a; wan_ip = a;
} }
Err(e) => { Err(e) => {
err = Some(e);
}
};
echoip_ratelimit_state.insert(echoip_url, Instant::now());
if wan_ip.is_some() {
break;
}
};
}
if wan_ip.is_none()
&& let Some(e) = err
{
tracing::error!( tracing::error!(
"{}", "{}",
t!( t!(
@@ -1336,13 +1349,6 @@ async fn poll_ip_info(
); );
tracing::debug!("{e:?}"); tracing::debug!("{e:?}");
} }
};
echoip_ratelimit_state.insert(echoip_url, Instant::now());
if wan_ip.is_some() {
break;
}
};
}
let mut ip_info = IpInfo { let mut ip_info = IpInfo {
name: name.clone(), name: name.clone(),
scope_id, scope_id,