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