diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2018-10-13 11:09:33 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-18 05:08:49 -0400 |
commit | fd2bb015c721c2db447272b4e9cd47fec353c6e1 (patch) | |
tree | 77b5ddc0ce6f80d7ef08c6103a5f2919f2e29963 | |
parent | 213885a9d00a913e3fd2eb21a5992efb63c888f5 (diff) |
fix metrics logic
-rw-r--r-- | src/isolate.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/isolate.rs b/src/isolate.rs index 0adfdb884..4d6f7cdfc 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -171,7 +171,6 @@ 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 { @@ -189,7 +188,9 @@ impl Isolate { // completing. self.ntasks_decrement(); // Call into JS with the buf. + let buf_size = buf.len() as u64; self.respond(req_id, buf); + self.state.metrics_op_completed(buf_size) } fn timeout(&mut self) { @@ -307,6 +308,7 @@ extern "C" fn pre_dispatch( if buf_size != 0 { // 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. |