log time that the function took

This commit is contained in:
Simon Laux
2023-12-12 02:53:43 +01:00
committed by bjoern
parent ea2a692d18
commit 8e073b9c3e

View File

@@ -448,6 +448,10 @@ impl Context {
return Ok(());
}
let address = self.get_primary_self_addr().await?;
let time_start = std::time::SystemTime::now();
info!(self, "background_fetch started fetching {address}");
let _pause_guard = self.scheduler.pause(self.clone()).await?;
// connection
@@ -467,6 +471,12 @@ impl Context {
warn!(self, "Failed to update quota: {:#}.", err);
}
info!(
self,
"background_fetch done for {address} took {:?}",
time_start.elapsed().unwrap_or_default()
);
Ok(())
}