chore: v2.5.0
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
d4abc60a 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
522eea03 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c
JB
8## [Unreleased]
9
a8766181
JB
10## [2.5.0] - 2023-05-31
11
e4543b14
JB
12### Added
13
14- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 15- Add tasks wait time accounting in per worker tasks usage.
71002f09 16- Add interleaved weighted round robin worker choice strategy (experimental).
e4543b14
JB
17
18### Changed
19
20- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
21
570efb11
JB
22## [2.4.14] - 2023-05-09
23
b0f28bad
JB
24### Fixed
25
26- Ensure no undefined task runtime can land in the tasks history.
27- Fix median computation implementation once again.
28
110b6d13
JB
29### Added
30
31- Unit tests for median and queue implementations.
32
72584880
JB
33## [2.4.13] - 2023-05-08
34
b0d6ed8f
JB
35### Fixed
36
e3058615 37- Fix worker choice strategy options validation.
b0d6ed8f
JB
38- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
39
06140c32
JB
40## [2.4.12] - 2023-05-06
41
a86b6df1
JB
42### Added
43
44- Support multiple task functions per worker.
08f3f44c 45- Add custom worker weights support to worker choice strategies options.
a86b6df1 46
29ee7e9a
JB
47### Changed
48
49- Use O(1) queue implementation for tasks queueing.
50
0682ba15
JB
51### Fixed
52
53- Fix median computation implementation.
54- Fix fair share worker choice strategy internals update.
55
936d53ec
JB
56## [2.4.11] - 2023-04-23
57
cb70b19d
JB
58### Changed
59
60- Optimize free worker finding in worker choice strategies.
61
15bb637a
JB
62## [2.4.10] - 2023-04-15
63
ef41a6e6
JB
64### Fixed
65
66- Fix typescript type definition for worker function: ensure the input data is optional.
67- Fix typescript type definition for pool execute(): ensure the input data is optional.
68
181eb2b4
JB
69## [2.4.9] - 2023-04-15
70
a20f0ba5
JB
71### Added
72
73- Add tasks queue enablement runtime setter to pool.
74- Add tasks queue options runtime setter to pool.
75- Add worker choice strategy options runtime setter to pool.
76
77### Changed
78
79- Remove the tasks queuing experimental status.
80
d4aeae5a
JB
81### Fixed
82
83- Fix worker function type definition and validation.
2fc5cae3 84- Fix worker choice strategy options handling.
d4aeae5a 85
1d9e7023
JB
86## [2.4.8] - 2023-04-12
87
f9b4bbf8
JB
88### Fixed
89
90- Fix message between main worker and worker type definition for tasks.
91- Fix code documentation.
92
12ae3210
JB
93## [2.4.7] - 2023-04-11
94
7171d33f
JB
95### Added
96
97- Add worker tasks queue options to pool options.
98
e8bd29ce
JB
99### Fixed
100
101- Fix missing documentation.
102
42c7bc10
JB
103## [2.4.6] - 2023-04-10
104
681196cc
JB
105### Fixed
106
107- Ensure one task at a time is executed per worker with tasks queueing enabled.
76545787 108- Properly count worker running tasks with tasks queueing enabled.
681196cc 109
54d360e3
JB
110## [2.4.5] - 2023-04-09
111
3fafb1b2
JB
112### Added
113
9e775f96
JB
114- Use monotonic high resolution timer for worker tasks runtime.
115- Add worker tasks median runtime to statistics.
ff733df7 116- Add worker tasks queue (experimental).
3fafb1b2 117
92fa3eb6
JB
118## [2.4.4] - 2023-04-07
119
aee46736
JB
120### Added
121
122- Add `PoolEvents` enumeration and `PoolEvent` type.
123
36b5e78f
JB
124### Fixed
125
ff0c2b3e 126- Destroy worker only on alive check.
36b5e78f 127
9fb0f324
JB
128## [2.4.3] - 2023-04-07
129
28cf3617
JB
130### Fixed
131
132- Fix typedoc generation with inheritance.
133
848f0f27
JB
134## [2.4.2] - 2023-04-06
135
164d950a
JB
136### Added
137
138- Add `full` event to dynamic pool.
32417142 139- Keep worker choice strategy in memory for conditional reuse.
164d950a 140
78ab2555
JB
141### Fixed
142
143- Fix possible negative worker key at worker removal in worker choice strategies.
144
79aafe9f
JB
145## [2.4.1] - 2023-04-05
146
9cd39dd4
JB
147### Changed
148
149- Optimize worker choice strategy for dynamic pool.
150
965415bb
JB
151### Fixed
152
153- Ensure dynamic pool does not alter worker choice strategy expected behavior.
154
d8b60b1c
JB
155## [2.4.0] - 2023-04-04
156
c6bd2650
JB
157### Added
158
159- Add `LESS_BUSY` worker choice strategy.
160
161### Changed
162
163- Optimize worker storage in pool.
164- Optimize worker alive status check.
165- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
166- Optimize `LESS_USED` worker choice strategy.
167- Update benchmarks versus external threads pools.
168- Optimize tasks usage statistics requirements for worker choice strategy.
169
170### Fixed
171
172- Ensure trimmable characters are checked at pool initialization.
173- Fix message id integer overflow.
174- Fix pool worker removal in worker choice strategy internals.
175- Fix package publication with pnpm.
176
d0a3f018
JB
177## [2.4.0-3] - 2023-04-04
178
b2ede285
JB
179### Added
180
181- Add `LESS_BUSY` worker choice strategy.
182
183### Changed
184
185- Optimize worker storage in pool.
186- Optimize worker alive status check.
187- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
188- Optimize `LESS_USED` worker choice strategy.
189- Update benchmarks versus external threads pools.
190
191### Fixed
192
193- Ensure trimmable characters are checked at pool initialization.
194- Fix message id integer overflow.
195- Fix pool worker removal in worker choice strategy internals.
196- Fix package publication with pnpm.
197
a015ea40
JB
198## [2.4.0-2] - 2023-04-03
199
698f4bbc
JB
200### Added
201
202- Add `LESS_BUSY` worker choice strategy.
203
204### Changed
205
206- Optimize worker storage in pool.
207- Optimize worker alive status check.
208- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
209- Optimize `LESS_USED` worker choice strategy.
210
211### Fixed
212
213- Ensure trimmable characters are checked at pool initialization.
214- Fix message id integer overflow.
215- Fix pool worker removal in worker choice strategy internals.
216- Fix package publication with pnpm.
217
8fe15920
JB
218## [2.4.0-1] - 2023-04-03
219
5b301c28
JB
220### Added
221
222- Add `LESS_BUSY` worker choice strategy.
223
224### Changed
225
226- Optimize worker storage in pool.
227- Optimize worker alive status check.
228- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
229- Optimize `LESS_USED` worker choice strategy.
230
231### Fixed
232
233- Ensure trimmable characters are checked at pool initialization.
234- Fix message id integer overflow.
235- Fix pool worker removal in worker choice strategy internals.
236
2fb9ca9c
JB
237## [2.4.0-0] - 2023-04-03
238
168c526f
JB
239### Added
240
241- Add `LESS_BUSY` worker choice strategy.
242
1d71a908
JB
243### Changed
244
ffcbbad8 245- Optimize worker storage in pool.
1d71a908 246- Optimize worker alive status check.
65a60b3b 247- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 248- Optimize `LESS_USED` worker choice strategy.
1d71a908 249
ffcbbad8
JB
250### Fixed
251
252- Ensure trimmable characters are checked at pool initialization.
b4e75778 253- Fix message id integer overflow.
97a2abc3 254- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 255
08372738
JB
256## [2.3.10] - 2023-03-18
257
710826bc
JB
258### Fixed
259
260- Fix `exports` syntax for ESM and CommonJS.
261
262### Changed
263
264- Permit SemVer pre-release publication.
76e5ac6f 265
e4796ecd
JB
266## [2.3.10-2] - 2023-03-18
267
6abad580
JB
268### Fixed
269
270- Fix `exports` syntax for ESM and CommonJS.
271
a2ee98cc
JB
272## [2.3.10-1] - 2023-03-18
273
7e060cee
JB
274### Changed
275
90483887 276- Permit SemVer pre-release publication.
7e060cee 277
c81bfafb
JB
278## [2.3.10-0] - 2023-03-18
279
fe18768d
JB
280### Fixed
281
282- Fix `exports` syntax for ESM and CommonJS.
283
d7b78217
JB
284## [2.3.9] - 2023-03-18
285
ed6dd37f
JB
286### Changed
287
288- Introduce ESM module support along with CommonJS one.
289
290### Fixed
291
292- Fix brown paper bag bug referencing the same object literal.
293
68e2ad86
JB
294## [2.3.8] - 2023-03-18
295
ca6c7d70
JB
296### Changed
297
298- Switch internal benchmarking code to benny.
fbdedeb9
JB
299- Switch to TypeScript 5.x.x.
300- Switch rollup bundler plugins to core ones.
ed6dd37f 301- Switch to TSDoc syntax.
fbdedeb9 302- Enforce conventional commits.
ca6c7d70 303
d15211d4
JB
304### Fixed
305
306- Fix random integer generator.
fbdedeb9 307- Fix worker choice strategy pool type identification at initialization.
d15211d4 308
995705ea
JB
309## [2.3.7] - 2022-10-23
310
b953022b
JB
311### Changed
312
313- Switch to open collective FOSS project funding platform.
78cea37e
JB
314- Switch to ts-standard linter configuration on TypeScript code.
315
316### Fixed
317
318- Fixed missing async on pool execute method.
319- Fixed typing in TypeScript example.
320- Fixed types in unit tests.
b953022b 321
3b9f6953
JB
322## [2.3.6] - 2022-10-22
323
f80cead4
JB
324### Changed
325
326- Cleanup pool attributes and methods.
327- Refine error types thrown.
328
329### Fixed
330
331- Fix continuous integration build on windows.
332- Fix code coverage reporting by using c8 instead of nyc.
333
efc22107
JB
334## [2.3.5] - 2022-10-21
335
7a6a0a96
JB
336### Changed
337
a05c10de
JB
338- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
339- Optimize tasks usage lookup implementation.
7a6a0a96 340
b4904890
JB
341### Fixed
342
343- Fix missed pool event emitter type export.
344- Fix typedoc documentation generation.
345
a875f8d1
JB
346## [2.3.4] - 2022-10-17
347
73cda448
JB
348### Added
349
350- Fully automate release process with release-it.
351
45a5a54c
JB
352### Changed
353
73cda448 354- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 355- Update benchmarks versus external pools results with latest version.
45a5a54c 356
90ee1b18 357## [2.3.3] - 2022-10-15
1a76932b
JB
358
359### Added
360
361- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
362
90ee1b18 363## [2.3.2] - 2022-10-14
11df3590
JB
364
365### Changed
366
367- Optimize fair share worker selection strategy implementation.
368
369### Fixed
370
371- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
372
90ee1b18 373## [2.3.1] - 2022-10-13
23ff945a
JB
374
375### Added
376
377- Pool worker choice strategies:
378 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
379 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
380
90ee1b18 381## [2.2.2] - 2022-10-09
cb2b6c69
JB
382
383### Fixed
384
385- Fixed `README.md` file.
386
90ee1b18 387## [2.2.1] - 2022-10-08
bdacc2d2 388
bdaf31cd
JB
389### Added
390
391- Dynamic worker choice strategy change at runtime.
bdacc2d2 392
90ee1b18 393## [2.2.0] - 2022-01-05
7e0d447f
JB
394
395### Breaking Changes
396
397- Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
398
90ee1b18 399## [2.1.0] - 2021-08-29
35cf1c03
JB
400
401### Added
402
403- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
404
405### Breaking Changes
406
407- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
408- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
409- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 410- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 411
90ee1b18 412## [2.0.2] - 2021-05-12
14916bf9
JB
413
414### Bug fixes
415
416- Fix `busy` event emission on fixed pool type
417
90ee1b18 418## [2.0.1] - 2021-03-16
7f685093
JB
419
420### Bug fixes
421
422- Check if pool options are properly set.
423- `busy` event is emitted on all pool types.
424
90ee1b18 425## [2.0.0] - 2021-03-01
fa0f5b28 426
f3f833ab 427### Bug fixes
d63d3be3 428
ddbeaffd 429- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 430
fa0f5b28
S
431### Breaking Changes
432
7f685093 433- `FullPool` event is now renamed to `busy`.
1927ee67 434- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 435 _Find more details on our JSDoc._
ddbeaffd 436
1927ee67
APA
437- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
438
ddbeaffd 439- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 440
ec2ccfc8
JB
441### Pool options types declaration merge
442
443`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
444
fa0f5b28
S
445#### New `export` strategy
446
447```js
448// Before
777b7824 449const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 450// After
777b7824 451const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
452```
453
454But you should always prefer just using
455
456```js
777b7824 457const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
458```
459
d3c8a1a8
S
460#### New type definitions for input data and response
461
ec2ccfc8 462For cluster worker and worker-thread pools, you can now only send and receive serializable data.
d3c8a1a8
S
463_This is not a limitation by poolifier but NodeJS._
464
3a4b605f 465#### Public property replacements
5c5a1fb7 466
3a4b605f 467`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 468
280c2a77 469#### Internal (protected) properties and methods renaming
fa0f5b28 470
280c2a77
S
471These properties are not intended for end users
472
473- `id` => `nextMessageId`
474
475These methods are not intended for end users
fa0f5b28
S
476
477- `_chooseWorker` => `chooseWorker`
280c2a77 478- `_newWorker` => `createWorker`
fa0f5b28
S
479- `_execute` => `internalExecute`
480- `_chooseWorker` => `chooseWorker`
481- `_checkAlive` => `checkAlive`
482- `_run` => `run`
483- `_runAsync` => `runAsync`
484
90ee1b18 485## [1.1.0] - 2020-05-21
0312f71a
APA
486
487### Added
488
489- ThreadWorker support async functions as option
cf9aa6c3 490- Various external library patches
0312f71a 491
90ee1b18 492## [1.0.0] - 2020-01-24
522eea03 493
494### Added
495
496- FixedThreadPool implementation
497- DynamicThreadPool implementation
0312f71a 498- WorkerThread implementation to improve developer experience