log & clippy

This commit is contained in:
Luna Yao
2026-04-06 11:54:50 +02:00
parent cddf6abfa7
commit 23f63f1e4a
6 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -109,6 +109,6 @@ impl DnsGlobalCtxExt for GlobalCtx {
} }
fn dns_iter_zones(&self) -> impl Iterator<Item = ZoneConfig> { fn dns_iter_zones(&self) -> impl Iterator<Item = ZoneConfig> {
iter::once(self.dns_self_zone()).chain(self.config.get_dns().zones.into_iter()) iter::once(self.dns_self_zone()).chain(self.config.get_dns().zones)
} }
} }
+2
View File
@@ -237,8 +237,10 @@ impl DnsNode {
.scoped_client::<DnsNodeMgrRpcClientFactory<BaseController>>("".to_string()) .scoped_client::<DnsNodeMgrRpcClientFactory<BaseController>>("".to_string())
.await?; .await?;
tracing::trace!(?request, "sending heartbeat");
let response = client.heartbeat(BaseController::default(), request).await?; let response = client.heartbeat(BaseController::default(), request).await?;
if response.resync { if response.resync {
tracing::trace!("resync requested by server, sending full snapshot");
client client
.heartbeat(BaseController::default(), heartbeat.clone()) .heartbeat(BaseController::default(), heartbeat.clone())
.await?; .await?;
+2
View File
@@ -18,6 +18,7 @@ use itertools::Itertools;
use moka::future::Cache; use moka::future::Cache;
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use tracing::instrument;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct DnsPeerInfo { pub struct DnsPeerInfo {
@@ -111,6 +112,7 @@ impl DnsPeerMgr {
self.dirty.notify_one(); self.dirty.notify_one();
} }
#[instrument(skip(self), level = "trace", ret)]
async fn fetch(&self, peer_id: PeerId) -> anyhow::Result<DnsPeerInfo> { async fn fetch(&self, peer_id: PeerId) -> anyhow::Result<DnsPeerInfo> {
self.peer_mgr self.peer_mgr
.get_peer_rpc_mgr() .get_peer_rpc_mgr()
+3 -3
View File
@@ -36,7 +36,7 @@ use tokio_util::sync::CancellationToken;
use tracing::{instrument, Instrument}; use tracing::{instrument, Instrument};
#[derive(Clone)] #[derive(Clone)]
struct DynamicCatalog { pub struct DynamicCatalog {
inner: Arc<tokio::sync::RwLock<Catalog>>, inner: Arc<tokio::sync::RwLock<Catalog>>,
} }
@@ -121,7 +121,7 @@ impl DnsServer {
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let listeners = listeners.into_iter().collect(); let listeners = listeners.into_iter().collect();
if &*self.listeners.read() == &listeners { if *self.listeners.read() == listeners {
tracing::info!("listeners unchanged, no need to reload"); tracing::info!("listeners unchanged, no need to reload");
return Ok(()); return Ok(());
} }
@@ -169,7 +169,7 @@ impl DnsServer {
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let addresses = addresses.into_iter().collect(); let addresses = addresses.into_iter().collect();
if &*self.addresses.read() == &addresses { if *self.addresses.read() == addresses {
tracing::info!("addresses unchanged, no need to reload"); tracing::info!("addresses unchanged, no need to reload");
return Ok(()); return Ok(());
} }
+1 -1
View File
@@ -77,7 +77,7 @@ impl ProxyCidrsMonitor {
pub fn start(self) -> ScopedTask<()> { pub fn start(self) -> ScopedTask<()> {
ScopedTask::from(tokio::spawn(async move { ScopedTask::from(tokio::spawn(async move {
let mut cur_proxy_cidrs = BTreeSet::new(); let mut cur_proxy_cidrs = BTreeSet::new();
let mut last_update = None::<Instant>; // let last_update = None::<Instant>;
loop { loop {
tokio::time::sleep(std::time::Duration::from_secs(1)).await; tokio::time::sleep(std::time::Duration::from_secs(1)).await;
+1 -1
View File
@@ -492,7 +492,7 @@ impl NetworkConfig {
.parse() .parse()
.with_context(|| format!("failed to parse instance id: {:?}", self.instance_id))?, .with_context(|| format!("failed to parse instance id: {:?}", self.instance_id))?,
); );
self.hostname.as_ref().map(|n| cfg.set_hostname(n)); if let Some(n) = self.hostname.as_ref() { cfg.set_hostname(n) }
cfg.set_dhcp(self.dhcp.unwrap_or_default()); cfg.set_dhcp(self.dhcp.unwrap_or_default());
cfg.set_inst_name(self.network_name.clone().unwrap_or_default()); cfg.set_inst_name(self.network_name.clone().unwrap_or_default());