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