diff --git a/yama/src/remote/requester.rs b/yama/src/remote/requester.rs index 84f5774..b4eb04d 100644 --- a/yama/src/remote/requester.rs +++ b/yama/src/remote/requester.rs @@ -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