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