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