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