@@ -41,7 +41,7 @@ import {
4141} from './selection-strategies/selection-strategies-types.ts'
4242import { WorkerChoiceStrategiesContext } from './selection-strategies/worker-choice-strategies-context.ts'
4343import {
44- checkFileURL ,
44+ checkSpecifier ,
4545 checkValidPriority ,
4646 checkValidTasksQueueOptions ,
4747 checkValidWorkerChoiceStrategy ,
@@ -152,13 +152,13 @@ export abstract class AbstractPool<
152152 * Constructs a new poolifier pool.
153153 *
154154 * @param minimumNumberOfWorkers - Minimum number of workers that this pool manages.
155- * @param fileURL - URL to the worker file.
155+ * @param specifier - Specifier to the worker file.
156156 * @param opts - Options for the pool.
157157 * @param maximumNumberOfWorkers - Maximum number of workers that this pool manages.
158158 */
159159 public constructor (
160160 protected readonly minimumNumberOfWorkers : number ,
161- protected readonly fileURL : URL ,
161+ protected readonly specifier : URL | string ,
162162 protected readonly opts : PoolOptions ,
163163 protected readonly maximumNumberOfWorkers ?: number ,
164164 ) {
@@ -168,7 +168,7 @@ export abstract class AbstractPool<
168168 )
169169 }
170170 this . checkPoolType ( )
171- checkFileURL ( this . fileURL )
171+ checkSpecifier ( this . specifier )
172172 this . checkMinimumNumberOfWorkers ( this . minimumNumberOfWorkers )
173173 this . checkPoolOptions ( this . opts )
174174
@@ -208,7 +208,7 @@ export abstract class AbstractPool<
208208 private checkPoolType ( ) : void {
209209 if ( this . type === PoolTypes . fixed && this . maximumNumberOfWorkers != null ) {
210210 throw new Error (
211- 'Cannot instantiate a fixed pool with a maximum number of workers specified at initialization' ,
211+ 'Cannot instantiate a fixed pool with a maximum number of workers defined at initialization' ,
212212 )
213213 }
214214 }
@@ -2292,15 +2292,19 @@ export abstract class AbstractPool<
22922292 * @returns The created worker node.
22932293 */
22942294 private createWorkerNode ( ) : IWorkerNode < Worker , Data > {
2295- const workerNode = new WorkerNode < Worker , Data > ( this . worker , this . fileURL , {
2296- workerOptions : this . opts . workerOptions ,
2297- tasksQueueBackPressureSize : this . opts . tasksQueueOptions ?. size ??
2298- getDefaultTasksQueueOptions (
2299- this . maximumNumberOfWorkers ?? this . minimumNumberOfWorkers ,
2300- ) . size ,
2301- tasksQueueBucketSize : defaultBucketSize ,
2302- tasksQueuePriority : this . getTasksQueuePriority ( ) ,
2303- } )
2295+ const workerNode = new WorkerNode < Worker , Data > (
2296+ this . worker ,
2297+ this . specifier ,
2298+ {
2299+ workerOptions : this . opts . workerOptions ,
2300+ tasksQueueBackPressureSize : this . opts . tasksQueueOptions ?. size ??
2301+ getDefaultTasksQueueOptions (
2302+ this . maximumNumberOfWorkers ?? this . minimumNumberOfWorkers ,
2303+ ) . size ,
2304+ tasksQueueBucketSize : defaultBucketSize ,
2305+ tasksQueuePriority : this . getTasksQueuePriority ( ) ,
2306+ } ,
2307+ )
23042308 // Flag the worker node as ready at pool startup.
23052309 if ( this . starting ) {
23062310 workerNode . info . ready = true
0 commit comments