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