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