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