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