Fix request IDs not getting freed up after a response was received
This commit is contained in:
parent
8f3b211d83
commit
680c8669d6
|
@ -158,13 +158,15 @@ impl Requester {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = in_flight.lock().or(Err(anyhow!("Mutex poisoned")))?;
|
let mut map = in_flight.lock().or(Err(anyhow!("Mutex poisoned")))?;
|
||||||
|
|
||||||
|
// We free up the ID as we get the sender out of the map.
|
||||||
let (resp_sender, req_instant) = map
|
let (resp_sender, req_instant) = map
|
||||||
.get(&response.response_to)
|
.remove(&response.response_to)
|
||||||
.ok_or(anyhow!("Didn't find response channel..."))?;
|
.ok_or(anyhow!("Didn't find response channel..."))?;
|
||||||
|
|
||||||
let req_resp_time_in_millis =
|
let req_resp_time_in_millis =
|
||||||
Instant::now().duration_since(*req_instant).as_millis() as f64;
|
Instant::now().duration_since(req_instant).as_millis() as f64;
|
||||||
histogram!("requester_cmd_response_time_ms", req_resp_time_in_millis);
|
histogram!("requester_cmd_response_time_ms", req_resp_time_in_millis);
|
||||||
|
|
||||||
resp_sender
|
resp_sender
|
||||||
|
|
Loading…
Reference in New Issue