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