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