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