Skip to content

Commit d984c86

Browse files
authored
belatedly address Ben's code review feedback (#395)
1 parent 9486068 commit d984c86

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

nexus/src/nexus.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ impl Nexus {
256256
"n_producers" => producers.len(),
257257
"collector_id" => ?oximeter_info.collector_id,
258258
);
259-
let (client, _) = self.build_oximeter_client(
260-
oximeter_info.collector_id,
259+
let client = self.build_oximeter_client(
260+
&oximeter_info.collector_id,
261261
oximeter_info.address,
262262
);
263263
for producer in producers.into_iter() {
@@ -316,26 +316,13 @@ impl Nexus {
316316
.expect("expected an infinite retry loop registering nexus as a metric producer");
317317
}
318318

319-
/// Return a client to the Oximeter instance with the given ID.
320-
pub async fn oximeter_client(
321-
&self,
322-
id: Uuid,
323-
) -> Result<(OximeterClient, Uuid), Error> {
324-
let oximeter_info = self.db_datastore.oximeter_fetch(id).await?;
325-
let address = SocketAddr::new(
326-
oximeter_info.ip.ip(),
327-
oximeter_info.port.try_into().unwrap(),
328-
);
329-
Ok(self.build_oximeter_client(oximeter_info.id, address))
330-
}
331-
332319
// Internal helper to build an Oximeter client from its ID and address (common data between
333320
// model type and the API type).
334321
fn build_oximeter_client(
335322
&self,
336-
id: Uuid,
323+
id: &Uuid,
337324
address: SocketAddr,
338-
) -> (OximeterClient, Uuid) {
325+
) -> OximeterClient {
339326
let client_log =
340327
self.log.new(o!("oximeter-collector" => id.to_string()));
341328
let client =
@@ -345,7 +332,7 @@ impl Nexus {
345332
"registered oximeter collector client";
346333
"id" => id.to_string(),
347334
);
348-
(client, id)
335+
client
349336
}
350337

351338
/**
@@ -2142,7 +2129,8 @@ impl Nexus {
21422129
})?;
21432130
let address =
21442131
SocketAddr::from((info.ip.ip(), info.port.try_into().unwrap()));
2145-
Ok(self.build_oximeter_client(info.id, address))
2132+
let id = info.id;
2133+
Ok((self.build_oximeter_client(&id, address), id))
21462134
}
21472135

21482136
pub async fn session_fetch(

0 commit comments

Comments
 (0)