X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fpool.ts;h=144d55002bd048ea865365cb6696cdb887745230;hb=d577f930d487c04ab3a6d63cbd25f68f95bc4298;hp=002bbbe2fdf7a4d19f5158d45e1b41620e7f2f20;hpb=4c0fcebf5632d2b216cdcb090fa7aac7ced9a04a;p=poolifier.git diff --git a/examples/typescript/pool.ts b/examples/typescript/pool.ts index 002bbbe2..144d5500 100644 --- a/examples/typescript/pool.ts +++ b/examples/typescript/pool.ts @@ -1,18 +1,18 @@ import { dirname, extname, join } from 'node:path' import { fileURLToPath } from 'node:url' +import type { MyData, MyResponse } from './worker.js' import { DynamicThreadPool, FixedThreadPool, availableParallelism } from 'poolifier' -import type { MyData, MyResponse } from './worker' const workerFile = join( dirname(fileURLToPath(import.meta.url)), `worker${extname(fileURLToPath(import.meta.url))}` ) -export const fixedPool = new FixedThreadPool>( +export const fixedPool = new FixedThreadPool( availableParallelism(), workerFile, { @@ -25,7 +25,7 @@ export const fixedPool = new FixedThreadPool>( } ) -export const dynamicPool = new DynamicThreadPool>( +export const dynamicPool = new DynamicThreadPool( Math.floor(availableParallelism() / 2), availableParallelism(), workerFile,