3 All notable changes to this project will be documented in this file.
5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12 - Fix typescript type definition for worker function: ensure the input data is optional.
13 - Fix typescript type definition for pool execute(): ensure the input data is optional.
15 ## [2.4.9] - 2023-04-15
19 - Add tasks queue enablement runtime setter to pool.
20 - Add tasks queue options runtime setter to pool.
21 - Add worker choice strategy options runtime setter to pool.
25 - Remove the tasks queuing experimental status.
29 - Fix worker function type definition and validation.
30 - Fix worker choice strategy options handling.
32 ## [2.4.8] - 2023-04-12
36 - Fix message between main worker and worker type definition for tasks.
37 - Fix code documentation.
39 ## [2.4.7] - 2023-04-11
43 - Add worker tasks queue options to pool options.
47 - Fix missing documentation.
49 ## [2.4.6] - 2023-04-10
53 - Ensure one task at a time is executed per worker with tasks queueing enabled.
54 - Properly count worker running tasks with tasks queueing enabled.
56 ## [2.4.5] - 2023-04-09
60 - Use monotonic high resolution timer for worker tasks run time.
61 - Add worker tasks median run time to statistics.
62 - Add worker tasks queue (experimental).
64 ## [2.4.4] - 2023-04-07
68 - Add `PoolEvents` enumeration and `PoolEvent` type.
72 - Destroy worker only on alive check.
74 ## [2.4.3] - 2023-04-07
78 - Fix typedoc generation with inheritance.
80 ## [2.4.2] - 2023-04-06
84 - Add `full` event to dynamic pool.
85 - Keep worker choice strategy in memory for conditional reuse.
89 - Fix possible negative worker key at worker removal in worker choice strategies.
91 ## [2.4.1] - 2023-04-05
95 - Optimize worker choice strategy for dynamic pool.
99 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
101 ## [2.4.0] - 2023-04-04
105 - Add `LESS_BUSY` worker choice strategy.
109 - Optimize worker storage in pool.
110 - Optimize worker alive status check.
111 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
112 - Optimize `LESS_USED` worker choice strategy.
113 - Update benchmarks versus external threads pools.
114 - Optimize tasks usage statistics requirements for worker choice strategy.
118 - Ensure trimmable characters are checked at pool initialization.
119 - Fix message id integer overflow.
120 - Fix pool worker removal in worker choice strategy internals.
121 - Fix package publication with pnpm.
123 ## [2.4.0-3] - 2023-04-04
127 - Add `LESS_BUSY` worker choice strategy.
131 - Optimize worker storage in pool.
132 - Optimize worker alive status check.
133 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
134 - Optimize `LESS_USED` worker choice strategy.
135 - Update benchmarks versus external threads pools.
139 - Ensure trimmable characters are checked at pool initialization.
140 - Fix message id integer overflow.
141 - Fix pool worker removal in worker choice strategy internals.
142 - Fix package publication with pnpm.
144 ## [2.4.0-2] - 2023-04-03
148 - Add `LESS_BUSY` worker choice strategy.
152 - Optimize worker storage in pool.
153 - Optimize worker alive status check.
154 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
155 - Optimize `LESS_USED` worker choice strategy.
159 - Ensure trimmable characters are checked at pool initialization.
160 - Fix message id integer overflow.
161 - Fix pool worker removal in worker choice strategy internals.
162 - Fix package publication with pnpm.
164 ## [2.4.0-1] - 2023-04-03
168 - Add `LESS_BUSY` worker choice strategy.
172 - Optimize worker storage in pool.
173 - Optimize worker alive status check.
174 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
175 - Optimize `LESS_USED` worker choice strategy.
179 - Ensure trimmable characters are checked at pool initialization.
180 - Fix message id integer overflow.
181 - Fix pool worker removal in worker choice strategy internals.
183 ## [2.4.0-0] - 2023-04-03
187 - Add `LESS_BUSY` worker choice strategy.
191 - Optimize worker storage in pool.
192 - Optimize worker alive status check.
193 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
194 - Optimize `LESS_USED` worker choice strategy.
198 - Ensure trimmable characters are checked at pool initialization.
199 - Fix message id integer overflow.
200 - Fix pool worker removal in worker choice strategy internals.
202 ## [2.3.10] - 2023-03-18
206 - Fix `exports` syntax for ESM and CommonJS.
210 - Permit SemVer pre-release publication.
212 ## [2.3.10-2] - 2023-03-18
216 - Fix `exports` syntax for ESM and CommonJS.
218 ## [2.3.10-1] - 2023-03-18
222 - Permit SemVer pre-release publication.
224 ## [2.3.10-0] - 2023-03-18
228 - Fix `exports` syntax for ESM and CommonJS.
230 ## [2.3.9] - 2023-03-18
234 - Introduce ESM module support along with CommonJS one.
238 - Fix brown paper bag bug referencing the same object literal.
240 ## [2.3.8] - 2023-03-18
244 - Switch internal benchmarking code to benny.
245 - Switch to TypeScript 5.x.x.
246 - Switch rollup bundler plugins to core ones.
247 - Switch to TSDoc syntax.
248 - Enforce conventional commits.
252 - Fix random integer generator.
253 - Fix worker choice strategy pool type identification at initialization.
255 ## [2.3.7] - 2022-10-23
259 - Switch to open collective FOSS project funding platform.
260 - Switch to ts-standard linter configuration on TypeScript code.
264 - Fixed missing async on pool execute method.
265 - Fixed typing in TypeScript example.
266 - Fixed types in unit tests.
268 ## [2.3.6] - 2022-10-22
272 - Cleanup pool attributes and methods.
273 - Refine error types thrown.
277 - Fix continuous integration build on windows.
278 - Fix code coverage reporting by using c8 instead of nyc.
280 ## [2.3.5] - 2022-10-21
284 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
285 - Optimize tasks usage lookup implementation.
289 - Fix missed pool event emitter type export.
290 - Fix typedoc documentation generation.
292 ## [2.3.4] - 2022-10-17
296 - Fully automate release process with release-it.
300 - Optimize fair share task scheduling algorithm implementation.
301 - Update benchmarks versus external pools results with latest version.
303 ## [2.3.3] - 2022-10-15
307 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
309 ## [2.3.2] - 2022-10-14
313 - Optimize fair share worker selection strategy implementation.
317 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
319 ## [2.3.1] - 2022-10-13
323 - Pool worker choice strategies:
324 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
325 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
327 ## [2.2.2] - 2022-10-09
331 - Fixed `README.md` file.
333 ## [2.2.1] - 2022-10-08
337 - Dynamic worker choice strategy change at runtime.
339 ## [2.2.0] - 2022-01-05
343 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
345 ## [2.1.0] - 2021-08-29
349 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
353 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
354 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
355 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
356 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
358 ## [2.0.2] - 2021-05-12
362 - Fix `busy` event emission on fixed pool type
364 ## [2.0.1] - 2021-03-16
368 - Check if pool options are properly set.
369 - `busy` event is emitted on all pool types.
371 ## [2.0.0] - 2021-03-01
375 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
379 - `FullPool` event is now renamed to `busy`.
380 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
381 _Find more details on our JSDoc._
383 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
385 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
387 ### Pool options types declaration merge
389 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
391 #### New `export` strategy
395 const DynamicThreadPool = require('poolifier/lib/dynamic')
397 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
400 But you should always prefer just using
403 const { DynamicThreadPool } = require('poolifier')
406 #### New type definitions for input data and response
408 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
409 _This is not a limitation by poolifier but NodeJS._
411 #### Public property replacements
413 `numWorkers` property is now `numberOfWorkers`
415 #### Internal (protected) properties and methods renaming
417 These properties are not intended for end users
419 - `id` => `nextMessageId`
421 These methods are not intended for end users
423 - `_chooseWorker` => `chooseWorker`
424 - `_newWorker` => `createWorker`
425 - `_execute` => `internalExecute`
426 - `_chooseWorker` => `chooseWorker`
427 - `_checkAlive` => `checkAlive`
429 - `_runAsync` => `runAsync`
431 ## [1.1.0] - 2020-05-21
435 - ThreadWorker support async functions as option
436 - Various external library patches
438 ## [1.0.0] - 2020-01-24
442 - FixedThreadPool implementation
443 - DynamicThreadPool implementation
444 - WorkerThread implementation to improve developer experience