forked from tinylibs/tinypool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent new workers from writing to closed pool
- Loading branch information
1 parent
ea05a00
commit cb7ce9f
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { cpus } from 'os' | ||
import { Tinypool } from 'tinypool' | ||
|
||
export default async function nestedPool() { | ||
const pool = new Tinypool({ | ||
filename: new URL(import.meta.url, import.meta.url).href, | ||
runtime: 'child_process', | ||
isolateWorkers: true, | ||
minThreads: cpus().length - 1, | ||
maxThreads: cpus().length - 1, | ||
}) | ||
|
||
await Promise.resolve() | ||
pool.recycleWorkers() | ||
} | ||
|
||
export function entrypoint() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters