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 worker function type definition and validation.
14 ## [2.4.8] - 2023-04-12
18 - Fix message between main worker and worker type definition for tasks.
19 - Fix code documentation.
21 ## [2.4.7] - 2023-04-11
25 - Add worker tasks queue options to pool options.
29 - Fix missing documentation.
31 ## [2.4.6] - 2023-04-10
35 - Ensure one task at a time is executed per worker with tasks queueing enabled.
36 - Properly count worker running tasks with tasks queueing enabled.
38 ## [2.4.5] - 2023-04-09
42 - Use monotonic high resolution timer for worker tasks run time.
43 - Add worker tasks median run time to statistics.
44 - Add worker tasks queue (experimental).
46 ## [2.4.4] - 2023-04-07
50 - Add `PoolEvents` enumeration and `PoolEvent` type.
54 - Destroy worker only on alive check.
56 ## [2.4.3] - 2023-04-07
60 - Fix typedoc generation with inheritance.
62 ## [2.4.2] - 2023-04-06
66 - Add `full` event to dynamic pool.
67 - Keep worker choice strategy in memory for conditional reuse.
71 - Fix possible negative worker key at worker removal in worker choice strategies.
73 ## [2.4.1] - 2023-04-05
77 - Optimize worker choice strategy for dynamic pool.
81 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
83 ## [2.4.0] - 2023-04-04
87 - Add `LESS_BUSY` worker choice strategy.
91 - Optimize worker storage in pool.
92 - Optimize worker alive status check.
93 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
94 - Optimize `LESS_USED` worker choice strategy.
95 - Update benchmarks versus external threads pools.
96 - Optimize tasks usage statistics requirements for worker choice strategy.
100 - Ensure trimmable characters are checked at pool initialization.
101 - Fix message id integer overflow.
102 - Fix pool worker removal in worker choice strategy internals.
103 - Fix package publication with pnpm.
105 ## [2.4.0-3] - 2023-04-04
109 - Add `LESS_BUSY` worker choice strategy.
113 - Optimize worker storage in pool.
114 - Optimize worker alive status check.
115 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
116 - Optimize `LESS_USED` worker choice strategy.
117 - Update benchmarks versus external threads pools.
121 - Ensure trimmable characters are checked at pool initialization.
122 - Fix message id integer overflow.
123 - Fix pool worker removal in worker choice strategy internals.
124 - Fix package publication with pnpm.
126 ## [2.4.0-2] - 2023-04-03
130 - Add `LESS_BUSY` worker choice strategy.
134 - Optimize worker storage in pool.
135 - Optimize worker alive status check.
136 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
137 - Optimize `LESS_USED` worker choice strategy.
141 - Ensure trimmable characters are checked at pool initialization.
142 - Fix message id integer overflow.
143 - Fix pool worker removal in worker choice strategy internals.
144 - Fix package publication with pnpm.
146 ## [2.4.0-1] - 2023-04-03
150 - Add `LESS_BUSY` worker choice strategy.
154 - Optimize worker storage in pool.
155 - Optimize worker alive status check.
156 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
157 - Optimize `LESS_USED` worker choice strategy.
161 - Ensure trimmable characters are checked at pool initialization.
162 - Fix message id integer overflow.
163 - Fix pool worker removal in worker choice strategy internals.
165 ## [2.4.0-0] - 2023-04-03
169 - Add `LESS_BUSY` worker choice strategy.
173 - Optimize worker storage in pool.
174 - Optimize worker alive status check.
175 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
176 - Optimize `LESS_USED` worker choice strategy.
180 - Ensure trimmable characters are checked at pool initialization.
181 - Fix message id integer overflow.
182 - Fix pool worker removal in worker choice strategy internals.
184 ## [2.3.10] - 2023-03-18
188 - Fix `exports` syntax for ESM and CommonJS.
192 - Permit SemVer pre-release publication.
194 ## [2.3.10-2] - 2023-03-18
198 - Fix `exports` syntax for ESM and CommonJS.
200 ## [2.3.10-1] - 2023-03-18
204 - Permit SemVer pre-release publication.
206 ## [2.3.10-0] - 2023-03-18
210 - Fix `exports` syntax for ESM and CommonJS.
212 ## [2.3.9] - 2023-03-18
216 - Introduce ESM module support along with CommonJS one.
220 - Fix brown paper bag bug referencing the same object literal.
222 ## [2.3.8] - 2023-03-18
226 - Switch internal benchmarking code to benny.
227 - Switch to TypeScript 5.x.x.
228 - Switch rollup bundler plugins to core ones.
229 - Switch to TSDoc syntax.
230 - Enforce conventional commits.
234 - Fix random integer generator.
235 - Fix worker choice strategy pool type identification at initialization.
237 ## [2.3.7] - 2022-10-23
241 - Switch to open collective FOSS project funding platform.
242 - Switch to ts-standard linter configuration on TypeScript code.
246 - Fixed missing async on pool execute method.
247 - Fixed typing in TypeScript example.
248 - Fixed types in unit tests.
250 ## [2.3.6] - 2022-10-22
254 - Cleanup pool attributes and methods.
255 - Refine error types thrown.
259 - Fix continuous integration build on windows.
260 - Fix code coverage reporting by using c8 instead of nyc.
262 ## [2.3.5] - 2022-10-21
266 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
267 - Optimize tasks usage lookup implementation.
271 - Fix missed pool event emitter type export.
272 - Fix typedoc documentation generation.
274 ## [2.3.4] - 2022-10-17
278 - Fully automate release process with release-it.
282 - Optimize fair share task scheduling algorithm implementation.
283 - Update benchmarks versus external pools results with latest version.
285 ## [2.3.3] - 2022-10-15
289 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
291 ## [2.3.2] - 2022-10-14
295 - Optimize fair share worker selection strategy implementation.
299 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
301 ## [2.3.1] - 2022-10-13
305 - Pool worker choice strategies:
306 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
307 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
309 ## [2.2.2] - 2022-10-09
313 - Fixed `README.md` file.
315 ## [2.2.1] - 2022-10-08
319 - Dynamic worker choice strategy change at runtime.
321 ## [2.2.0] - 2022-01-05
325 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
327 ## [2.1.0] - 2021-08-29
331 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
335 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
336 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
337 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
338 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
340 ## [2.0.2] - 2021-05-12
344 - Fix `busy` event emission on fixed pool type
346 ## [2.0.1] - 2021-03-16
350 - Check if pool options are properly set.
351 - `busy` event is emitted on all pool types.
353 ## [2.0.0] - 2021-03-01
357 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
361 - `FullPool` event is now renamed to `busy`.
362 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
363 _Find more details on our JSDoc._
365 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
367 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
369 ### Pool options types declaration merge
371 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
373 #### New `export` strategy
377 const DynamicThreadPool = require('poolifier/lib/dynamic')
379 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
382 But you should always prefer just using
385 const { DynamicThreadPool } = require('poolifier')
388 #### New type definitions for input data and response
390 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
391 _This is not a limitation by poolifier but NodeJS._
393 #### Public property replacements
395 `numWorkers` property is now `numberOfWorkers`
397 #### Internal (protected) properties and methods renaming
399 These properties are not intended for end users
401 - `id` => `nextMessageId`
403 These methods are not intended for end users
405 - `_chooseWorker` => `chooseWorker`
406 - `_newWorker` => `createWorker`
407 - `_execute` => `internalExecute`
408 - `_chooseWorker` => `chooseWorker`
409 - `_checkAlive` => `checkAlive`
411 - `_runAsync` => `runAsync`
413 ## [1.1.0] - 2020-05-21
417 - ThreadWorker support async functions as option
418 - Various external library patches
420 ## [1.0.0] - 2020-01-24
424 - FixedThreadPool implementation
425 - DynamicThreadPool implementation
426 - WorkerThread implementation to improve developer experience