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