From cb52b71f63bdee8b0f33b0b6be07bf8a8acbc5fb Mon Sep 17 00:00:00 2001 From: Anthony MOI Date: Thu, 9 Jan 2020 15:43:16 -0500 Subject: [PATCH] Node - Fix tasks count --- bindings/node/native/src/tokenizer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/node/native/src/tokenizer.rs b/bindings/node/native/src/tokenizer.rs index 136f35fb..4fb652d4 100644 --- a/bindings/node/native/src/tokenizer.rs +++ b/bindings/node/native/src/tokenizer.rs @@ -44,7 +44,7 @@ declare_types! { let this = cx.this(); let guard = cx.lock(); let count = std::sync::Arc::strong_count(&this.borrow(&guard).running_task); - count + if count > 0 { count - 1 } else { 0 } }; Ok(cx.number(running as f64).upcast()) } @@ -71,7 +71,7 @@ declare_types! { count }; if running > 1 { - println!("{} running tasks", running); + println!("{} running tasks", running - 1); return cx.throw_error("Cannot modify the tokenizer while there are running tasks"); }