mirror of
https://github.com/mii443/tokenizers.git
synced 2025-09-02 15:29:21 +00:00
Node - Fix tasks count
This commit is contained in:
@ -44,7 +44,7 @@ declare_types! {
|
|||||||
let this = cx.this();
|
let this = cx.this();
|
||||||
let guard = cx.lock();
|
let guard = cx.lock();
|
||||||
let count = std::sync::Arc::strong_count(&this.borrow(&guard).running_task);
|
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())
|
Ok(cx.number(running as f64).upcast())
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ declare_types! {
|
|||||||
count
|
count
|
||||||
};
|
};
|
||||||
if running > 1 {
|
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");
|
return cx.throw_error("Cannot modify the tokenizer while there are running tasks");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user