diff --git a/agent-info/Cargo.toml b/agent-info/Cargo.toml index 90e2bc122..6e1731d41 100644 --- a/agent-info/Cargo.toml +++ b/agent-info/Cargo.toml @@ -6,6 +6,9 @@ edition.workspace = true version.workspace = true license.workspace = true +[lib] +bench = false + [dependencies] anyhow = "1.0.86" arc-swap = "1.7.1" diff --git a/agent-info/src/fetcher.rs b/agent-info/src/fetcher.rs index 9650f4224..faa8f2194 100644 --- a/agent-info/src/fetcher.rs +++ b/agent-info/src/fetcher.rs @@ -55,8 +55,8 @@ async fn fetch_info_with_state( /// Fetch the info endpoint once and return the info. /// -/// Can be used for one-time access to the agent's info. If you need to access the info over -/// long period use `AgentInfoFetcher` to keep the info up-to-date. +/// Can be used for one-time access to the agent's info. If you need to access the info several +/// times use `AgentInfoFetcher` to keep the info up-to-date. /// /// # Example /// ```no_run @@ -78,7 +78,7 @@ pub async fn fetch_info(info_endpoint: &Endpoint) -> Result> { } } -/// Fetch the info endpoint and update an ArcSwap based on a given time interval. +/// Fetch the info endpoint and update an ArcSwap keeping it up-to-date. /// /// Once the fetcher has been created you can get an Arc of the config by calling `get_info`. /// You can then start the run method, the fetcher will update the AgentInfoArc based on the @@ -120,17 +120,18 @@ pub struct AgentInfoFetcher { impl AgentInfoFetcher { /// Return a new `AgentInfoFetcher` fetching the `info_endpoint` on each `refresh_interval` /// and updating the stored info. - pub fn new(info_endpoint: Endpoint, fetch_interval: Duration) -> Self { + pub fn new(info_endpoint: Endpoint, refresh_interval: Duration) -> Self { Self { info_endpoint, info: Arc::new(ArcSwapOption::new(None)), - refresh_interval: fetch_interval, + refresh_interval, } } /// Start fetching the info endpoint with the given interval. /// - /// Warning: This method does not return and should be called within a dedicated task. + /// # Warning + /// This method does not return and should be called within a dedicated task. pub async fn run(&self) { loop { let current_info = self.info.load();