Commit | Line | Data |
---|---|---|
522eea03 | 1 | # Changelog |
2 | ||
3 | All notable changes to this project will be documented in this file. | |
4 | ||
d4abc60a | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), |
522eea03 | 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
7 | ||
45a5a54c JB |
8 | ## [Unreleased] |
9 | ||
0e05c4dc JB |
10 | ### Added |
11 | ||
12 | - Allow to disable tasks timeout check in worker. | |
13 | ||
a8766181 JB |
14 | ## [2.5.0] - 2023-05-31 |
15 | ||
e4543b14 JB |
16 | ### Added |
17 | ||
18 | - Switch pool event emitter to `EventEmitterAsyncResource`. | |
6da80d38 | 19 | - Add tasks wait time accounting in per worker tasks usage. |
71002f09 | 20 | - Add interleaved weighted round robin worker choice strategy (experimental). |
e4543b14 JB |
21 | |
22 | ### Changed | |
23 | ||
24 | - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`. | |
25 | ||
570efb11 JB |
26 | ## [2.4.14] - 2023-05-09 |
27 | ||
b0f28bad JB |
28 | ### Fixed |
29 | ||
30 | - Ensure no undefined task runtime can land in the tasks history. | |
31 | - Fix median computation implementation once again. | |
32 | ||
110b6d13 JB |
33 | ### Added |
34 | ||
35 | - Unit tests for median and queue implementations. | |
36 | ||
72584880 JB |
37 | ## [2.4.13] - 2023-05-08 |
38 | ||
b0d6ed8f JB |
39 | ### Fixed |
40 | ||
e3058615 | 41 | - Fix worker choice strategy options validation. |
b0d6ed8f JB |
42 | - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission. |
43 | ||
06140c32 JB |
44 | ## [2.4.12] - 2023-05-06 |
45 | ||
a86b6df1 JB |
46 | ### Added |
47 | ||
48 | - Support multiple task functions per worker. | |
08f3f44c | 49 | - Add custom worker weights support to worker choice strategies options. |
a86b6df1 | 50 | |
29ee7e9a JB |
51 | ### Changed |
52 | ||
53 | - Use O(1) queue implementation for tasks queueing. | |
54 | ||
0682ba15 JB |
55 | ### Fixed |
56 | ||
57 | - Fix median computation implementation. | |
58 | - Fix fair share worker choice strategy internals update. | |
59 | ||
936d53ec JB |
60 | ## [2.4.11] - 2023-04-23 |
61 | ||
cb70b19d JB |
62 | ### Changed |
63 | ||
64 | - Optimize free worker finding in worker choice strategies. | |
65 | ||
15bb637a JB |
66 | ## [2.4.10] - 2023-04-15 |
67 | ||
ef41a6e6 JB |
68 | ### Fixed |
69 | ||
70 | - Fix typescript type definition for worker function: ensure the input data is optional. | |
71 | - Fix typescript type definition for pool execute(): ensure the input data is optional. | |
72 | ||
181eb2b4 JB |
73 | ## [2.4.9] - 2023-04-15 |
74 | ||
a20f0ba5 JB |
75 | ### Added |
76 | ||
77 | - Add tasks queue enablement runtime setter to pool. | |
78 | - Add tasks queue options runtime setter to pool. | |
79 | - Add worker choice strategy options runtime setter to pool. | |
80 | ||
81 | ### Changed | |
82 | ||
83 | - Remove the tasks queuing experimental status. | |
84 | ||
d4aeae5a JB |
85 | ### Fixed |
86 | ||
87 | - Fix worker function type definition and validation. | |
2fc5cae3 | 88 | - Fix worker choice strategy options handling. |
d4aeae5a | 89 | |
1d9e7023 JB |
90 | ## [2.4.8] - 2023-04-12 |
91 | ||
f9b4bbf8 JB |
92 | ### Fixed |
93 | ||
94 | - Fix message between main worker and worker type definition for tasks. | |
95 | - Fix code documentation. | |
96 | ||
12ae3210 JB |
97 | ## [2.4.7] - 2023-04-11 |
98 | ||
7171d33f JB |
99 | ### Added |
100 | ||
101 | - Add worker tasks queue options to pool options. | |
102 | ||
e8bd29ce JB |
103 | ### Fixed |
104 | ||
105 | - Fix missing documentation. | |
106 | ||
42c7bc10 JB |
107 | ## [2.4.6] - 2023-04-10 |
108 | ||
681196cc JB |
109 | ### Fixed |
110 | ||
111 | - Ensure one task at a time is executed per worker with tasks queueing enabled. | |
76545787 | 112 | - Properly count worker running tasks with tasks queueing enabled. |
681196cc | 113 | |
54d360e3 JB |
114 | ## [2.4.5] - 2023-04-09 |
115 | ||
3fafb1b2 JB |
116 | ### Added |
117 | ||
9e775f96 JB |
118 | - Use monotonic high resolution timer for worker tasks runtime. |
119 | - Add worker tasks median runtime to statistics. | |
ff733df7 | 120 | - Add worker tasks queue (experimental). |
3fafb1b2 | 121 | |
92fa3eb6 JB |
122 | ## [2.4.4] - 2023-04-07 |
123 | ||
aee46736 JB |
124 | ### Added |
125 | ||
126 | - Add `PoolEvents` enumeration and `PoolEvent` type. | |
127 | ||
36b5e78f JB |
128 | ### Fixed |
129 | ||
ff0c2b3e | 130 | - Destroy worker only on alive check. |
36b5e78f | 131 | |
9fb0f324 JB |
132 | ## [2.4.3] - 2023-04-07 |
133 | ||
28cf3617 JB |
134 | ### Fixed |
135 | ||
136 | - Fix typedoc generation with inheritance. | |
137 | ||
848f0f27 JB |
138 | ## [2.4.2] - 2023-04-06 |
139 | ||
164d950a JB |
140 | ### Added |
141 | ||
142 | - Add `full` event to dynamic pool. | |
32417142 | 143 | - Keep worker choice strategy in memory for conditional reuse. |
164d950a | 144 | |
78ab2555 JB |
145 | ### Fixed |
146 | ||
147 | - Fix possible negative worker key at worker removal in worker choice strategies. | |
148 | ||
79aafe9f JB |
149 | ## [2.4.1] - 2023-04-05 |
150 | ||
9cd39dd4 JB |
151 | ### Changed |
152 | ||
153 | - Optimize worker choice strategy for dynamic pool. | |
154 | ||
965415bb JB |
155 | ### Fixed |
156 | ||
157 | - Ensure dynamic pool does not alter worker choice strategy expected behavior. | |
158 | ||
d8b60b1c JB |
159 | ## [2.4.0] - 2023-04-04 |
160 | ||
c6bd2650 JB |
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 | - Update benchmarks versus external threads pools. | |
172 | - Optimize tasks usage statistics requirements for 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 | - Fix package publication with pnpm. | |
180 | ||
d0a3f018 JB |
181 | ## [2.4.0-3] - 2023-04-04 |
182 | ||
b2ede285 JB |
183 | ### Added |
184 | ||
185 | - Add `LESS_BUSY` worker choice strategy. | |
186 | ||
187 | ### Changed | |
188 | ||
189 | - Optimize worker storage in pool. | |
190 | - Optimize worker alive status check. | |
191 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
192 | - Optimize `LESS_USED` worker choice strategy. | |
193 | - Update benchmarks versus external threads pools. | |
194 | ||
195 | ### Fixed | |
196 | ||
197 | - Ensure trimmable characters are checked at pool initialization. | |
198 | - Fix message id integer overflow. | |
199 | - Fix pool worker removal in worker choice strategy internals. | |
200 | - Fix package publication with pnpm. | |
201 | ||
a015ea40 JB |
202 | ## [2.4.0-2] - 2023-04-03 |
203 | ||
698f4bbc JB |
204 | ### Added |
205 | ||
206 | - Add `LESS_BUSY` worker choice strategy. | |
207 | ||
208 | ### Changed | |
209 | ||
210 | - Optimize worker storage in pool. | |
211 | - Optimize worker alive status check. | |
212 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
213 | - Optimize `LESS_USED` worker choice strategy. | |
214 | ||
215 | ### Fixed | |
216 | ||
217 | - Ensure trimmable characters are checked at pool initialization. | |
218 | - Fix message id integer overflow. | |
219 | - Fix pool worker removal in worker choice strategy internals. | |
220 | - Fix package publication with pnpm. | |
221 | ||
8fe15920 JB |
222 | ## [2.4.0-1] - 2023-04-03 |
223 | ||
5b301c28 JB |
224 | ### Added |
225 | ||
226 | - Add `LESS_BUSY` worker choice strategy. | |
227 | ||
228 | ### Changed | |
229 | ||
230 | - Optimize worker storage in pool. | |
231 | - Optimize worker alive status check. | |
232 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
233 | - Optimize `LESS_USED` worker choice strategy. | |
234 | ||
235 | ### Fixed | |
236 | ||
237 | - Ensure trimmable characters are checked at pool initialization. | |
238 | - Fix message id integer overflow. | |
239 | - Fix pool worker removal in worker choice strategy internals. | |
240 | ||
2fb9ca9c JB |
241 | ## [2.4.0-0] - 2023-04-03 |
242 | ||
168c526f JB |
243 | ### Added |
244 | ||
245 | - Add `LESS_BUSY` worker choice strategy. | |
246 | ||
1d71a908 JB |
247 | ### Changed |
248 | ||
ffcbbad8 | 249 | - Optimize worker storage in pool. |
1d71a908 | 250 | - Optimize worker alive status check. |
65a60b3b | 251 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
737c6d97 | 252 | - Optimize `LESS_USED` worker choice strategy. |
1d71a908 | 253 | |
ffcbbad8 JB |
254 | ### Fixed |
255 | ||
256 | - Ensure trimmable characters are checked at pool initialization. | |
b4e75778 | 257 | - Fix message id integer overflow. |
97a2abc3 | 258 | - Fix pool worker removal in worker choice strategy internals. |
ffcbbad8 | 259 | |
08372738 JB |
260 | ## [2.3.10] - 2023-03-18 |
261 | ||
710826bc JB |
262 | ### Fixed |
263 | ||
264 | - Fix `exports` syntax for ESM and CommonJS. | |
265 | ||
266 | ### Changed | |
267 | ||
268 | - Permit SemVer pre-release publication. | |
76e5ac6f | 269 | |
e4796ecd JB |
270 | ## [2.3.10-2] - 2023-03-18 |
271 | ||
6abad580 JB |
272 | ### Fixed |
273 | ||
274 | - Fix `exports` syntax for ESM and CommonJS. | |
275 | ||
a2ee98cc JB |
276 | ## [2.3.10-1] - 2023-03-18 |
277 | ||
7e060cee JB |
278 | ### Changed |
279 | ||
90483887 | 280 | - Permit SemVer pre-release publication. |
7e060cee | 281 | |
c81bfafb JB |
282 | ## [2.3.10-0] - 2023-03-18 |
283 | ||
fe18768d JB |
284 | ### Fixed |
285 | ||
286 | - Fix `exports` syntax for ESM and CommonJS. | |
287 | ||
d7b78217 JB |
288 | ## [2.3.9] - 2023-03-18 |
289 | ||
ed6dd37f JB |
290 | ### Changed |
291 | ||
292 | - Introduce ESM module support along with CommonJS one. | |
293 | ||
294 | ### Fixed | |
295 | ||
296 | - Fix brown paper bag bug referencing the same object literal. | |
297 | ||
68e2ad86 JB |
298 | ## [2.3.8] - 2023-03-18 |
299 | ||
ca6c7d70 JB |
300 | ### Changed |
301 | ||
302 | - Switch internal benchmarking code to benny. | |
fbdedeb9 JB |
303 | - Switch to TypeScript 5.x.x. |
304 | - Switch rollup bundler plugins to core ones. | |
ed6dd37f | 305 | - Switch to TSDoc syntax. |
fbdedeb9 | 306 | - Enforce conventional commits. |
ca6c7d70 | 307 | |
d15211d4 JB |
308 | ### Fixed |
309 | ||
310 | - Fix random integer generator. | |
fbdedeb9 | 311 | - Fix worker choice strategy pool type identification at initialization. |
d15211d4 | 312 | |
995705ea JB |
313 | ## [2.3.7] - 2022-10-23 |
314 | ||
b953022b JB |
315 | ### Changed |
316 | ||
317 | - Switch to open collective FOSS project funding platform. | |
78cea37e JB |
318 | - Switch to ts-standard linter configuration on TypeScript code. |
319 | ||
320 | ### Fixed | |
321 | ||
322 | - Fixed missing async on pool execute method. | |
323 | - Fixed typing in TypeScript example. | |
324 | - Fixed types in unit tests. | |
b953022b | 325 | |
3b9f6953 JB |
326 | ## [2.3.6] - 2022-10-22 |
327 | ||
f80cead4 JB |
328 | ### Changed |
329 | ||
330 | - Cleanup pool attributes and methods. | |
331 | - Refine error types thrown. | |
332 | ||
333 | ### Fixed | |
334 | ||
335 | - Fix continuous integration build on windows. | |
336 | - Fix code coverage reporting by using c8 instead of nyc. | |
337 | ||
efc22107 JB |
338 | ## [2.3.5] - 2022-10-21 |
339 | ||
7a6a0a96 JB |
340 | ### Changed |
341 | ||
a05c10de JB |
342 | - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter. |
343 | - Optimize tasks usage lookup implementation. | |
7a6a0a96 | 344 | |
b4904890 JB |
345 | ### Fixed |
346 | ||
347 | - Fix missed pool event emitter type export. | |
348 | - Fix typedoc documentation generation. | |
349 | ||
a875f8d1 JB |
350 | ## [2.3.4] - 2022-10-17 |
351 | ||
73cda448 JB |
352 | ### Added |
353 | ||
354 | - Fully automate release process with release-it. | |
355 | ||
45a5a54c JB |
356 | ### Changed |
357 | ||
73cda448 | 358 | - Optimize fair share task scheduling algorithm implementation. |
eb4a8a82 | 359 | - Update benchmarks versus external pools results with latest version. |
45a5a54c | 360 | |
90ee1b18 | 361 | ## [2.3.3] - 2022-10-15 |
1a76932b JB |
362 | |
363 | ### Added | |
364 | ||
365 | - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options. | |
366 | ||
90ee1b18 | 367 | ## [2.3.2] - 2022-10-14 |
11df3590 JB |
368 | |
369 | ### Changed | |
370 | ||
371 | - Optimize fair share worker selection strategy implementation. | |
372 | ||
373 | ### Fixed | |
374 | ||
375 | - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled. | |
376 | ||
90ee1b18 | 377 | ## [2.3.1] - 2022-10-13 |
23ff945a JB |
378 | |
379 | ### Added | |
380 | ||
381 | - Pool worker choice strategies: | |
382 | - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now. | |
383 | - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now. | |
384 | ||
90ee1b18 | 385 | ## [2.2.2] - 2022-10-09 |
cb2b6c69 JB |
386 | |
387 | ### Fixed | |
388 | ||
389 | - Fixed `README.md` file. | |
390 | ||
90ee1b18 | 391 | ## [2.2.1] - 2022-10-08 |
bdacc2d2 | 392 | |
bdaf31cd JB |
393 | ### Added |
394 | ||
395 | - Dynamic worker choice strategy change at runtime. | |
bdacc2d2 | 396 | |
90ee1b18 | 397 | ## [2.2.0] - 2022-01-05 |
7e0d447f JB |
398 | |
399 | ### Breaking Changes | |
400 | ||
401 | - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version. | |
402 | ||
90ee1b18 | 403 | ## [2.1.0] - 2021-08-29 |
35cf1c03 JB |
404 | |
405 | ### Added | |
406 | ||
407 | - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker. | |
e088a00c JB |
408 | |
409 | ### Breaking Changes | |
410 | ||
411 | - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute. | |
412 | - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`. | |
413 | - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`. | |
c365b2d3 | 414 | - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker. |
e088a00c | 415 | |
90ee1b18 | 416 | ## [2.0.2] - 2021-05-12 |
14916bf9 JB |
417 | |
418 | ### Bug fixes | |
419 | ||
420 | - Fix `busy` event emission on fixed pool type | |
421 | ||
90ee1b18 | 422 | ## [2.0.1] - 2021-03-16 |
7f685093 JB |
423 | |
424 | ### Bug fixes | |
425 | ||
426 | - Check if pool options are properly set. | |
427 | - `busy` event is emitted on all pool types. | |
428 | ||
90ee1b18 | 429 | ## [2.0.0] - 2021-03-01 |
fa0f5b28 | 430 | |
f3f833ab | 431 | ### Bug fixes |
d63d3be3 | 432 | |
ddbeaffd | 433 | - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70). |
d63d3be3 | 434 | |
fa0f5b28 S |
435 | ### Breaking Changes |
436 | ||
7f685093 | 437 | - `FullPool` event is now renamed to `busy`. |
1927ee67 | 438 | - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`. |
1a81f8af | 439 | _Find more details on our JSDoc._ |
ddbeaffd | 440 | |
1927ee67 APA |
441 | - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed. |
442 | ||
ddbeaffd | 443 | - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes. |
fa0f5b28 | 444 | |
ec2ccfc8 JB |
445 | ### Pool options types declaration merge |
446 | ||
447 | `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`. | |
448 | ||
fa0f5b28 S |
449 | #### New `export` strategy |
450 | ||
451 | ```js | |
452 | // Before | |
777b7824 | 453 | const DynamicThreadPool = require('poolifier/lib/dynamic') |
fa0f5b28 | 454 | // After |
777b7824 | 455 | const { DynamicThreadPool } = require('poolifier/lib/dynamic') |
fa0f5b28 S |
456 | ``` |
457 | ||
458 | But you should always prefer just using | |
459 | ||
460 | ```js | |
777b7824 | 461 | const { DynamicThreadPool } = require('poolifier') |
fa0f5b28 S |
462 | ``` |
463 | ||
d3c8a1a8 S |
464 | #### New type definitions for input data and response |
465 | ||
ec2ccfc8 | 466 | For cluster worker and worker-thread pools, you can now only send and receive serializable data. |
d3c8a1a8 S |
467 | _This is not a limitation by poolifier but NodeJS._ |
468 | ||
3a4b605f | 469 | #### Public property replacements |
5c5a1fb7 | 470 | |
3a4b605f | 471 | `numWorkers` property is now `numberOfWorkers` |
5c5a1fb7 | 472 | |
280c2a77 | 473 | #### Internal (protected) properties and methods renaming |
fa0f5b28 | 474 | |
280c2a77 S |
475 | These properties are not intended for end users |
476 | ||
477 | - `id` => `nextMessageId` | |
478 | ||
479 | These methods are not intended for end users | |
fa0f5b28 S |
480 | |
481 | - `_chooseWorker` => `chooseWorker` | |
280c2a77 | 482 | - `_newWorker` => `createWorker` |
fa0f5b28 S |
483 | - `_execute` => `internalExecute` |
484 | - `_chooseWorker` => `chooseWorker` | |
485 | - `_checkAlive` => `checkAlive` | |
486 | - `_run` => `run` | |
487 | - `_runAsync` => `runAsync` | |
488 | ||
90ee1b18 | 489 | ## [1.1.0] - 2020-05-21 |
0312f71a APA |
490 | |
491 | ### Added | |
492 | ||
493 | - ThreadWorker support async functions as option | |
cf9aa6c3 | 494 | - Various external library patches |
0312f71a | 495 | |
90ee1b18 | 496 | ## [1.0.0] - 2020-01-24 |
522eea03 | 497 | |
498 | ### Added | |
499 | ||
500 | - FixedThreadPool implementation | |
501 | - DynamicThreadPool implementation | |
0312f71a | 502 | - WorkerThread implementation to improve developer experience |