mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
update workerpool to v3.1 (#36388)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
cebfdd1f30
commit
1e71bbdf52
Vendored
+7
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for workerpool 2.3
|
||||
// Type definitions for workerpool 3.1
|
||||
// Project: https://github.com/josdejong/workerpool
|
||||
// Definitions by: Alorel <https://github.com/Alorel>
|
||||
// Seulgi Kim <https://github.com/sgkim126>
|
||||
@@ -92,6 +92,12 @@ export interface WorkerPoolOptions {
|
||||
* When the number of CPU's could not be determined (for example in older browsers), maxWorkers is set to 3.
|
||||
*/
|
||||
maxWorkers?: number;
|
||||
/**
|
||||
* In case of 'process' (default), child_process will be used.
|
||||
* In case of 'thread', worker_threads will be used. If worker_threads are not available, an error is thrown.
|
||||
* In case of 'auto', worker_threads will be used if available (Node.js >= 11.7.0), else child_process will be used as fallback.
|
||||
*/
|
||||
nodeWorker?: 'process' | 'thread' | 'auto';
|
||||
|
||||
/** 2nd argument to pass to childProcess.fork() */
|
||||
forkArgs?: string[];
|
||||
|
||||
@@ -6,6 +6,9 @@ wp.pool({minWorkers: 'max'});
|
||||
wp.pool({minWorkers: 'max', maxWorkers: 1});
|
||||
wp.pool({minWorkers: 1, maxWorkers: 1});
|
||||
wp.pool({maxWorkers: 1});
|
||||
wp.pool({nodeWorker: 'process'});
|
||||
wp.pool({nodeWorker: 'thread'});
|
||||
wp.pool({nodeWorker: 'auto'});
|
||||
wp.pool({forkArgs: ['foo', 'bar']});
|
||||
wp.pool({forkOpts: {cwd: '/tmp'}});
|
||||
const pool = wp.pool();
|
||||
|
||||
Reference in New Issue
Block a user