Node - Fix tasks count

This commit is contained in:
Anthony MOI
2020-01-09 15:43:16 -05:00
parent 6561511214
commit cb52b71f63

View File

@ -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");
}