Skip to content

Commit

Permalink
fix: dynamic worker file
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Oct 6, 2023
1 parent 88d56bf commit ff481de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/misc/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import { DynamicThreadPool, availableParallelism } from "poolifier";

const logger = new Logger("ThreadPool");


const workerFile = path.join(
__dirname,
`workers${path.extname(__filename)}`
);


/* Creating a new thread pool with half of available threads and a maximum of available threads. */
export const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), availableParallelism(), path.resolve(__dirname, "workers.js"), {
export const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), availableParallelism(), workerFile, {
enableTasksQueue: true,
tasksQueueOptions: {
concurrency: 8
Expand Down

0 comments on commit ff481de

Please sign in to comment.