Skip to content

Commit

Permalink
Moving duration calculation after replies are sent
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-rei authored and m-reichert committed Mar 20, 2024
1 parent 72d88dd commit 726e90a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/electrum/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,19 +557,21 @@ impl Connection {
);

let reply = self.handle_command(method, params, id)?;
let reply_size = reply.to_string().as_bytes().len();
let send_result = self.send_values(&[reply]);

conditionally_log_rpc_event!(
self,
json!({
"event": "rpc response",
"method": method,
"payload_size": reply.to_string().as_bytes().len(),
"payload_size": reply_size,
"duration_micros": start_time.elapsed().as_micros(),
"id": id,
})
);

self.send_values(&[reply])?
send_result?
}
_ => {
bail!("invalid command: {}", cmd)
Expand Down

0 comments on commit 726e90a

Please sign in to comment.