1.0.2 • Published 3 years ago

@pooley/scalers v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@pooley/scalers

Implements different scalers for @pooley/core.

@pooley/scalers

ScalerDescription
StaticWorkerPoolScalerAllocates a static number of workers based on a static size
HtmlInputWorkerPoolScalerAllocates workers based on the current value of the HTMLInputElement and dynamically updates workers size as the value changes

Install

Install the library with it's core peer dependency:

npm install @pooley/scalers @pooley/core

Usage

StaticWorkerPoolScaler

import { WorkerPool } from '@pooley/core';
import { StaticWorkerPoolScaler } from '@pooley/scalers';

// Create a pool with static worker pool scaler
const pool = new WorkerPool({
  task,
  queue,
  poolScaler: new StaticWorkerPoolScaler(5),
  workerProcessorFactory,
});

HtmlInputWorkerPoolScaler

import { WorkerPool } from '@pooley/core';
import { HtmlInputWorkerPoolScaler } from '@pooley/scalers';

// Create a pool with input worker pool scaler
const pool = new WorkerPool({
  task,
  queue,
  poolScaler: new HtmlInputWorkerPoolScaler(document.querySelector('input')),
  processorFactory,
});

Building

Run nx build scalers to build the library.

Running unit tests

Run nx test scalers to execute the unit tests via Jest.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago