@@ -55,8 +55,8 @@ async fn fetch_info_with_state(
55
55
56
56
/// Fetch the info endpoint once and return the info.
57
57
///
58
- /// Can be used for one-time access to the agent's info. If you need to access the info over
59
- /// long period use `AgentInfoFetcher` to keep the info up-to-date.
58
+ /// Can be used for one-time access to the agent's info. If you need to access the info several
59
+ /// times use `AgentInfoFetcher` to keep the info up-to-date.
60
60
///
61
61
/// # Example
62
62
/// ```no_run
@@ -78,7 +78,7 @@ pub async fn fetch_info(info_endpoint: &Endpoint) -> Result<Box<AgentInfo>> {
78
78
}
79
79
}
80
80
81
- /// Fetch the info endpoint and update an ArcSwap based on a given time interval .
81
+ /// Fetch the info endpoint and update an ArcSwap keeping it up-to-date .
82
82
///
83
83
/// Once the fetcher has been created you can get an Arc of the config by calling `get_info`.
84
84
/// You can then start the run method, the fetcher will update the AgentInfoArc based on the
@@ -120,17 +120,18 @@ pub struct AgentInfoFetcher {
120
120
impl AgentInfoFetcher {
121
121
/// Return a new `AgentInfoFetcher` fetching the `info_endpoint` on each `refresh_interval`
122
122
/// and updating the stored info.
123
- pub fn new ( info_endpoint : Endpoint , fetch_interval : Duration ) -> Self {
123
+ pub fn new ( info_endpoint : Endpoint , refresh_interval : Duration ) -> Self {
124
124
Self {
125
125
info_endpoint,
126
126
info : Arc :: new ( ArcSwapOption :: new ( None ) ) ,
127
- refresh_interval : fetch_interval ,
127
+ refresh_interval,
128
128
}
129
129
}
130
130
131
131
/// Start fetching the info endpoint with the given interval.
132
132
///
133
- /// Warning: This method does not return and should be called within a dedicated task.
133
+ /// # Warning
134
+ /// This method does not return and should be called within a dedicated task.
134
135
pub async fn run ( & self ) {
135
136
loop {
136
137
let current_info = self . info . load ( ) ;
0 commit comments