diff options
-rw-r--r-- | src/isolate.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/isolate.rs b/src/isolate.rs index 408259c5f..e24471356 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -157,6 +157,7 @@ impl Isolate { } pub fn respond(&mut self, req_id: i32, buf: Buf) { + self.state.metrics_op_completed(buf.len() as u64); // TODO(zero-copy) Use Buf::leak(buf) to leak the heap allocated buf. And // don't do the memcpy in ImportBuf() (in libdeno/binding.cc) unsafe { @@ -284,8 +285,6 @@ extern "C" fn pre_dispatch( // Set the synchronous response, the value returned from isolate.send(). isolate.respond(req_id, buf); } - - isolate.state.metrics_op_completed(buf_size as u64); } else { // Execute op asynchronously. let state = Arc::clone(&isolate.state); @@ -297,9 +296,7 @@ extern "C" fn pre_dispatch( let task = op .and_then(move |buf| { - let buf_size = buf.len(); state.send_to_js(req_id, buf); - state.metrics_op_completed(buf_size as u64); Ok(()) }).map_err(|_| ()); tokio::spawn(task); |