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