X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicClusterPool.html;h=77cdcd29be25504d72f3344b91605c6c7ea39394;hb=a75da00c7b8dbbb148d2cf2472ce73e4201d9a4a;hp=f032491ea8cfdd791c10de1bf35de7c42d0fabad;hpb=8662ea71e523af81c1138618f0e12b89df35ce8a;p=poolifier.git diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index f032491e..77cdcd29 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -1,11 +1,13 @@ DynamicClusterPool | poolifier
-
+
@@ -18,10 +20,6 @@

This cluster pool creates new workers when the others are busy, up to the maximum number of workers. When the maximum number of workers is reached, an event is emitted. If you want to listen to this event, use the pool's emitter.

-

Template

of data sent to the worker. This can only be serializable data.

- -

Template

of response of execution. This can only be serializable data.

-

Author

Christopher Quadflieg

Since

2.0.0

@@ -30,9 +28,13 @@ When the maximum number of workers is reached, an event is emitted. If you want

Type Parameters

  • -

    Data = unknown

  • +

    Data = unknown

    +

    Type of data sent to the worker. This can only be serializable data.

    +
  • -

    Response = unknown

+

Response = unknown

+

Type of response of execution. This can only be serializable data.

+

Hierarchy

    @@ -40,7 +42,7 @@ When the maximum number of workers is reached, an event is emitted. If you want
    • DynamicClusterPool
+
  • Defined in src/pools/cluster/dynamic.ts:16
  • @@ -54,14 +56,12 @@ When the maximum number of workers is reached, an event is emitted. If you want

    Properties

    Accessors

    @@ -71,21 +71,16 @@ When the maximum number of workers is reached, an event is emitted. If you want

    Methods

    -
    +
  • Defined in src/pools/cluster/dynamic.ts:28
  • Properties

    -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:32
  • -
    filePath: string
    -
    - +
  • Defined in src/pools/abstract-pool.ts:67
  • +
    +
    max: number
    -
    -

    Inherit Doc

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    +

    Maximum number of workers that can be created by this pool.

    +
  • Defined in src/pools/cluster/dynamic.ts:30
  • -
    numberOfWorkers: number
    +
  • Defined in src/pools/abstract-pool.ts:66
  • -
    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...
    -

    The promise map.

    +
  • Defined in src/pools/cluster/fixed.ts:53
  • +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Worker, Response>> = ...
    +

    The promise response map.

      -
    • key: This is the message Id of each submitted task.
    • -
    • value: An object that contains the worker, the resolve function and the reject function.
    • +
    • key: The message id of each submitted task.
    • +
    • value: An object that contains the worker, the promise resolve and reject callbacks.
    -

    When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

    +

    When we receive a message from the worker we get a map entry with the promise resolve/reject bound to the message.

    +
  • Defined in src/pools/abstract-pool.ts:42
  • workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    @@ -199,23 +191,15 @@ When the maximum number of workers is reached, an event is emitted. If you want
    +
  • Defined in src/pools/abstract-pool.ts:52
  • -
    workers: Worker[] = []
    -
    -

    Inherit Doc

    -
    - -
    workersTasksUsage: Map<Worker, TasksUsage> = ...
    -
    -

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:29
  • Accessors

    @@ -223,40 +207,40 @@ When the maximum number of workers is reached, an event is emitted. If you want
    +
  • Defined in src/pools/cluster/dynamic.ts:43
  • +
  • Defined in src/pools/abstract-pool.ts:141
  • +
  • Defined in src/pools/cluster/dynamic.ts:38
  • Methods

    -
    - +
    +
      - +
    • Hook executed after the worker task promise resolution. Can be overridden.

      @@ -265,24 +249,24 @@ Can be overridden.

      Parameters

      • -
        message: MessageValue<Response, unknown>
        -

        The received message.

        +
        worker: Worker
        +

        The worker.

      • -
        promise: PromiseWorkerResponseWrapper<Worker, Response>
        -

        The Promise response.

        +
        message: MessageValue<Response, unknown>
        +

        The received message.

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:252
  • -
    - +
  • Defined in src/pools/cluster/fixed.ts:93
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:241
  • +
  • Defined in src/pools/abstract-pool.ts:292
  • +
  • Defined in src/pools/abstract-pool.ts:337
  • +
  • Defined in src/pools/cluster/fixed.ts:88
  • +
  • Defined in src/pools/abstract-pool.ts:207
  • +
  • Defined in src/pools/cluster/fixed.ts:69
  • -
    - -
    -
    - -
    -
    - +
  • Defined in src/pools/abstract-pool.ts:192
  • +
    +
    -
    - -
    -
    - -
    -
    - -
    +
  • Defined in src/pools/abstract-pool.ts:185
  • +
  • Defined in src/pools/abstract-pool.ts:177
  • +
  • Defined in src/pools/cluster/fixed.ts:64
  • +
  • Defined in src/pools/abstract-pool.ts:279
  • +
  • Defined in src/pools/cluster/fixed.ts:75
  • Returns void

    +
  • Defined in src/pools/abstract-pool.ts:156
  • +
  • Defined in src/pools/cluster/fixed.ts:59
  • +
  • Defined in src/pools/abstract-pool.ts:366