Skip to content

Commit

Permalink
Log time for GET requests (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M authored Mar 7, 2022
1 parent 456e670 commit 47e5f66
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/node_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ impl HttpClient {
}

pub(crate) async fn get(&self, node: Node, _timeout: Duration) -> Result<Response> {
let mut request_builder = self.client.get(node.url);
let syc_start_time = std::time::Instant::now();
let mut request_builder = self.client.get(node.url.clone());
if let Some(jwt) = node.jwt {
request_builder = request_builder.bearer_auth(jwt);
}
Expand All @@ -664,7 +665,13 @@ impl HttpClient {
request_builder = request_builder.timeout(_timeout);
}
let resp = request_builder.send().await?;
Self::parse_response(resp).await
let response = Self::parse_response(resp).await;
log::debug!(
"GET request took {:?} ms for {}",
syc_start_time.elapsed().as_millis(),
node.url
);
response
}

pub(crate) async fn post_bytes(&self, node: Node, _timeout: Duration, body: &[u8]) -> Result<Response> {
Expand Down

0 comments on commit 47e5f66

Please sign in to comment.