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