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