Fix request IDs not getting freed up after a response was received

This commit is contained in:
Olivier 'reivilibre' 2022-01-13 20:18:11 +00:00
parent 8f3b211d83
commit 680c8669d6
1 changed files with 5 additions and 3 deletions

View File

@ -158,13 +158,15 @@ impl Requester {
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
.get(&response.response_to)
.remove(&response.response_to)
.ok_or(anyhow!("Didn't find response channel..."))?;
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);
resp_sender