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 | ||
5a24d71c JB |
10 | ## [2.6.37] - 2023-08-28 |
11 | ||
bdb9d712 JB |
12 | ### Fixed |
13 | ||
14 | - Ensure unused worker usage statistics are deleted at runtime. | |
15 | ||
8c0b113f JB |
16 | ### Changed |
17 | ||
18 | - Rename worker choice strategy options `choiceRetries` to `retries`. | |
574c5c8d | 19 | - Avoid unnecessary branching in worker choice strategies. |
8c0b113f | 20 | |
ba821940 JB |
21 | ## [2.6.36] - 2023-08-27 |
22 | ||
9d2d0da1 JB |
23 | ### Fixed |
24 | ||
25 | - Fix pool `execute()` arguments check. | |
26 | ||
1f0766e7 JB |
27 | ### Changed |
28 | ||
29 | - Make continuous tasks stealing algorithm less aggressive. | |
8780236f | 30 | - Fine tune tasks stealing algorithm under back pressure. |
1f0766e7 | 31 | |
ffd2c1ff JB |
32 | ## [2.6.35] - 2023-08-25 |
33 | ||
dc021bcc JB |
34 | ### Fixed |
35 | ||
36 | - Don't account worker usage statistics for tasks that have failed. | |
3baa0837 | 37 | - Fix pool information runtime and wait time median computation. |
dc021bcc JB |
38 | |
39 | ### Changed | |
40 | ||
41 | - Update simple moving average implementation to use a circular buffer. | |
42 | - Update simple moving median implementation to use a circular buffer. | |
68cbdc84 JB |
43 | - Account for stolen tasks in worker usage statistics and pool information. |
44 | ||
45 | ### Added | |
46 | ||
47 | - Continuous tasks stealing algorithm. | |
dc021bcc | 48 | |
c58bc2a1 JB |
49 | ## [2.6.34] - 2023-08-24 |
50 | ||
0bc68267 JB |
51 | ### Fixes |
52 | ||
53 | - Avoid cascading tasks stealing under back pressure. | |
54 | ||
55 | ### Changed | |
56 | ||
57 | - Add fastpath to queued tasks rescheduling. | |
58 | ||
39fb7ad0 JB |
59 | ## [2.6.33] - 2023-08-24 |
60 | ||
dd951876 JB |
61 | ### Fixed |
62 | ||
63 | - Fix queued tasks rescheduling. | |
64 | ||
ff3f866a JB |
65 | ### Changed |
66 | ||
67 | - Rename tasks queue options `queueMaxSize` to `size`. | |
68 | ||
a6b3272b | 69 | ### Added |
dd951876 | 70 | |
a6b3272b | 71 | - Task stealing scheduling algorithm if tasks queueing is enabled. |
dd951876 | 72 | |
c55c9b5d JB |
73 | ## [2.6.32] - 2023-08-23 |
74 | ||
15b176e0 JB |
75 | ### Fixed |
76 | ||
77 | - Ensure no task can be executed when the pool is destroyed. | |
78 | ||
20c6f652 JB |
79 | ### Added |
80 | ||
81 | - Add `queueMaxSize` option to tasks queue options. | |
574b351d | 82 | - Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing. |
72695f86 | 83 | - Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled. |
20c6f652 | 84 | |
e560a9f2 JB |
85 | ## [2.6.31] - 2023-08-20 |
86 | ||
b1aae695 JB |
87 | ### Fixed |
88 | ||
3e8611a8 | 89 | - Fix worker choice strategy retries mechanism in some edge cases. |
b1aae695 | 90 | |
94407def JB |
91 | ### Changed |
92 | ||
e695d66f | 93 | - Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage. |
a71b05bc | 94 | - Remove the experimental status of the `LEAST_ELU` worker choice strategy. |
94407def | 95 | |
962b9863 JB |
96 | ## [2.6.30] - 2023-08-19 |
97 | ||
33e6bb4c JB |
98 | ### Fixed |
99 | ||
100 | - Ensure pool event `backPressure` is emitted. | |
101 | - Ensure pool event `full` is emitted only once. | |
8735b4e5 | 102 | - Ensure worker node cannot be instantiated without proper arguments. |
33e6bb4c | 103 | |
8cc4ea81 JB |
104 | ## [2.6.29] - 2023-08-18 |
105 | ||
6169563b JB |
106 | ### Fixed |
107 | ||
108 | - Fix race condition between ready and task functions worker message handling at startup. | |
5dd4043c | 109 | - Fix duplicate task function worker usage statistics computation per task function. |
db0e38ee | 110 | - Update task function worker usage statistics if and only if there's at least two different task functions. |
5bb5be17 | 111 | - Fix race condition at task function worker usage executing task computation leading to negative value. |
6169563b | 112 | |
8990357d JB |
113 | ### Added |
114 | ||
445264e8 | 115 | - Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2). |
8990357d JB |
116 | - Use back pressure detection in worker choice strategies. |
117 | - Add worker choice strategies retries mechanism if no worker is eligible. | |
118 | ||
21157987 JB |
119 | ## [2.6.28] - 2023-08-16 |
120 | ||
f05ed93c JB |
121 | ### Fixed |
122 | ||
123 | - Ensure pool workers are properly initialized. | |
124 | ||
12d67776 JB |
125 | ### Added |
126 | ||
127 | - HTTP server pool examples: express-cluster, express-hybrid. | |
128 | ||
d18fccb1 JB |
129 | ### Changed |
130 | ||
131 | - Remove now useless branching in worker hot code path. | |
132 | ||
741cdb34 JB |
133 | ## [2.6.27] - 2023-08-15 |
134 | ||
50e7f498 JB |
135 | ### Fixed |
136 | ||
137 | - Add `KillHandler` type definition to exported types. | |
138 | ||
ef3891a3 JB |
139 | ### Added |
140 | ||
141 | - Add `destroy` event to pool API. | |
142 | ||
e9dc6efa JB |
143 | ## [2.6.26] - 2023-08-15 |
144 | ||
2b099bf7 JB |
145 | ### Added |
146 | ||
147 | - Add kill handler to worker options allowing to execute custom code when worker is killed. | |
ef3891a3 | 148 | - Add `listTaskFunctions()` method to pool API. |
9aef1431 | 149 | - SMTP server pool example: nodemailer. |
2b099bf7 | 150 | |
5b726f72 JB |
151 | ## [2.6.25] - 2023-08-13 |
152 | ||
72855e92 JB |
153 | ### Added |
154 | ||
3b311539 | 155 | - HTTP server pool examples: fastify-cluster, fastify-hybrid. |
02999424 | 156 | - WebSocket server pool examples: ws-cluster, ws-hybrid. |
72855e92 | 157 | |
7aadd6e5 JB |
158 | ## [2.6.24] - 2023-08-12 |
159 | ||
7d91a8cd JB |
160 | ### Added |
161 | ||
162 | - Add array of transferable objects to the `execute()` method arguments. | |
02999424 | 163 | - WebSocket server pool examples: ws-worker_threads. |
7d91a8cd | 164 | |
6b4263b4 JB |
165 | ## [2.6.23] - 2023-08-11 |
166 | ||
3d76750a | 167 | ### Fixed |
8e0af894 | 168 | |
3d76750a | 169 | - Fix pool busyness semantic when tasks queueing is enabled: the pool is busy when the number of executing tasks on each worker has reached the maximum tasks concurrency per worker. |
9606b474 | 170 | |
3d76750a JB |
171 | ### Added |
172 | ||
173 | - HTTP client pool examples: fetch, node-fetch and axios with multiple task functions. | |
02999424 | 174 | - HTTP server pool examples: express-worker_threads, fastify-worker_threads. |
3d76750a JB |
175 | |
176 | ## [2.6.22] - 2023-08-10 | |
9606b474 | 177 | |
3d76750a | 178 | ### Fixed |
9606b474 JB |
179 | |
180 | - Add missing `types` field to package.json `exports`. | |
181 | ||
3d76750a JB |
182 | ### Changed |
183 | ||
184 | - Structure markdown documentation (PR #811). | |
185 | ||
d9647bdd JB |
186 | ## [2.6.21] - 2023-08-03 |
187 | ||
2111ec12 JB |
188 | ### Changed |
189 | ||
190 | - Improve code documentation. | |
191 | - Code refactoring and cleanup for better maintainability and readability. | |
192 | ||
5c30b9d9 JB |
193 | ## [2.6.20] - 2023-07-21 |
194 | ||
10ecf8fd JB |
195 | ### Fixed |
196 | ||
197 | - Fix queued tasks redistribution on error task execution starvation. | |
a1763c54 | 198 | - Ensure tasks queueing per worker condition is untangled from the pool busyness semantic. |
10ecf8fd | 199 | |
aa9eede8 JB |
200 | ### Changed |
201 | ||
7c89e6a4 | 202 | - Drastically reduce lookups by worker in the worker nodes. |
aa9eede8 | 203 | |
62485908 JB |
204 | ## [2.6.19] - 2023-07-20 |
205 | ||
2e2ef9c3 JB |
206 | ### Added |
207 | ||
208 | - Dedicated internal communication channel for worker_threads pools. | |
209 | ||
8f4c9491 JB |
210 | ## [2.6.18] - 2023-07-19 |
211 | ||
8660b972 JB |
212 | ### Changed |
213 | ||
214 | - Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller. | |
215 | ||
206a3519 JB |
216 | ## [2.6.17] - 2023-07-16 |
217 | ||
b4899fae JB |
218 | ### Added |
219 | ||
1a3e01ba | 220 | - Add `listTaskFunctions()` method to worker API. |
b4899fae | 221 | |
58a06a6c JB |
222 | ## [2.6.16] - 2023-07-12 |
223 | ||
2a69b8c5 JB |
224 | ### Fixed |
225 | ||
80520ca4 | 226 | - Fix pool startup detection. |
2a69b8c5 JB |
227 | - Fix worker task functions handling. |
228 | ||
b5900b02 JB |
229 | ## [2.6.15] - 2023-07-11 |
230 | ||
19dbc45b JB |
231 | ### Added |
232 | ||
233 | - Take into account worker node readiness in worker choice strategies. | |
234 | ||
4a0db581 JB |
235 | ## [2.6.14] - 2023-07-10 |
236 | ||
87e44747 JB |
237 | ### Fixed |
238 | ||
239 | - Fix task function statistics tracking. | |
240 | ||
0265272f JB |
241 | ## [2.6.13] - 2023-07-10 |
242 | ||
968a2e8c JB |
243 | ### Added |
244 | ||
245 | - Add per task function statistics tracking. | |
782299f8 | 246 | - Add public methods to manipulate the worker task functions at runtime. |
968a2e8c | 247 | |
44c8c00f JB |
248 | ## [2.6.12] - 2023-07-09 |
249 | ||
aa4bf4b2 JB |
250 | ### Fixed |
251 | ||
252 | - Workaround import issue with `node:os` module in node 16.x.x. | |
253 | ||
b7cfced1 JB |
254 | ## [2.6.11] - 2023-07-09 |
255 | ||
d5024c00 JB |
256 | ### Fixed |
257 | ||
258 | - Fix pool readiness semantic. | |
259 | ||
f313a208 JB |
260 | ## [2.6.10] - 2023-07-08 |
261 | ||
2431bdb4 JB |
262 | ### Fixed |
263 | ||
264 | - Ensure workers are not recreated on error at pool startup. | |
265 | ||
266 | ### Added | |
267 | ||
268 | - Add `ready` and `strategy` fields to pool information. | |
269 | - Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready. | |
caadbd41 | 270 | - Add dynamic pool sizing checks. |
2431bdb4 | 271 | |
369d0a51 JB |
272 | ## [2.6.9] - 2023-07-07 |
273 | ||
2845f2a5 JB |
274 | ### Fixed |
275 | ||
276 | - Recreate the right worker type on uncaught exception. | |
277 | ||
278 | ### Added | |
279 | ||
280 | - Add minimum and maximum to internal measurement statistics. | |
1dcf8b7b | 281 | - Add `runTime` and `waitTime` to pool information. |
75d3401a | 282 | - Check worker inactive time only on dynamic worker. |
2845f2a5 | 283 | |
fc97d613 JB |
284 | ## [2.6.8] - 2023-07-03 |
285 | ||
92b1feaa JB |
286 | ### Fixed |
287 | ||
288 | - Brown paper bag release to fix version handling in pool information. | |
289 | ||
52d54060 JB |
290 | ## [2.6.7] - 2023-07-03 |
291 | ||
5bc91f3e JB |
292 | ### Fixed |
293 | ||
294 | - Ensure worker queued tasks at error are reassigned to other pool workers. | |
295 | ||
afe0d5bf JB |
296 | ### Added |
297 | ||
298 | - Add pool `utilization` ratio to pool information. | |
23ccf9d7 | 299 | - Add `version` to pool information. |
e5b3047d | 300 | - Add worker information to worker nodes. |
afe0d5bf | 301 | |
f42c583f JB |
302 | ## [2.6.6] - 2023-07-01 |
303 | ||
6961ca9a JB |
304 | ### Added |
305 | ||
d5e3c4ff | 306 | - Add safe helper `availableParallelism()` to help sizing the pool. |
6961ca9a | 307 | |
3749facb JB |
308 | ### Fixed |
309 | ||
310 | - Ensure message handler is only registered in worker. | |
311 | ||
6fed2513 JB |
312 | ## [2.6.5] - 2023-06-27 |
313 | ||
c72f6987 JB |
314 | ### Known issues |
315 | ||
70726c28 | 316 | - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782 |
c72f6987 JB |
317 | |
318 | ### Fixed | |
319 | ||
320 | - Artificial version bump to 2.6.5 to workaround publication issue. | |
d5e3c4ff | 321 | - Ensure cluster pool `destroy()` gracefully shutdowns worker's server. |
c72f6987 JB |
322 | - Ensure pool event is emitted before task error promise rejection. |
323 | - Fix queued tasks count computation. | |
324 | ||
325 | ### Removed | |
326 | ||
2fbe1783 | 327 | - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. |
c72f6987 | 328 | |
6426631b JB |
329 | ## [2.6.4] - 2023-06-27 |
330 | ||
941f9a7c JB |
331 | ### Known issues |
332 | ||
70726c28 | 333 | - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782 |
941f9a7c | 334 | |
2c039e43 JB |
335 | ### Fixed |
336 | ||
d5e3c4ff | 337 | - Ensure cluster pool `destroy()` gracefully shutdowns worker's server. |
2c039e43 | 338 | - Ensure pool event is emitted before task error promise rejection. |
9c16fb4b | 339 | - Fix queued tasks count computation. |
2c039e43 | 340 | |
941f9a7c JB |
341 | ### Removed |
342 | ||
2fbe1783 | 343 | - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. |
941f9a7c | 344 | |
bc1b0765 JB |
345 | ## [2.6.3] - 2023-06-19 |
346 | ||
a6a2dc4c JB |
347 | ### Fixed |
348 | ||
349 | - Ensure no tasks are queued when trying to soft kill a dynamic worker. | |
f0d7f803 | 350 | - Update strategies internals after statistics computation. |
a6a2dc4c | 351 | |
7b56f532 JB |
352 | ### Changed |
353 | ||
354 | - Optimize O(1) queue implementation. | |
355 | ||
b628596c JB |
356 | ## [2.6.2] - 2023-06-12 |
357 | ||
a9e89d00 JB |
358 | ### Fixed |
359 | ||
360 | - Fix new worker use after creation in dynamic pool given the current worker choice strategy. | |
361 | ||
4368a898 JB |
362 | ## [2.6.1] - 2023-06-10 |
363 | ||
931d43e2 JB |
364 | ### Added |
365 | ||
13ab5b87 | 366 | - Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md). |
931d43e2 | 367 | |
f1c06930 JB |
368 | ### Fixed |
369 | ||
370 | - Fix average statistics computation: ensure failed tasks are not accounted. | |
371 | ||
16671b07 JB |
372 | ## [2.6.0] - 2023-06-09 |
373 | ||
a1347286 JB |
374 | ### Added |
375 | ||
5af9c0f7 | 376 | - Add `LEAST_ELU` worker choice strategy (experimental). |
9adcefab | 377 | - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy. |
a1347286 | 378 | |
1c6fe997 JB |
379 | ### Changed |
380 | ||
381 | - Refactor pool worker node usage internals. | |
477f48e7 | 382 | - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed. |
f63a9dda | 383 | - Breaking change: pool information `info` property object fields have been renamed. |
1c6fe997 JB |
384 | |
385 | ### Fixed | |
386 | ||
387 | - Fix wait time accounting. | |
388 | - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time. | |
389 | - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks. | |
390 | ||
aa07d6ee JB |
391 | ## [2.5.4] - 2023-06-07 |
392 | ||
b6b32453 JB |
393 | ### Added |
394 | ||
395 | - Add Event Loop Utilization (ELU) statistics to worker tasks usage. | |
396 | ||
397 | ### Changed | |
398 | ||
399 | - Compute statistics at the worker level only if needed. | |
2fbe1783 | 400 | - Add `worker_threads` options to thread pool options. |
b6b32453 | 401 | |
272d4d8f JB |
402 | ### Fixed |
403 | ||
404 | - Make the `LEAST_BUSY` strategy only relies on task runtime. | |
405 | ||
ed47fb3d JB |
406 | ## [2.5.3] - 2023-06-04 |
407 | ||
89a4abfd JB |
408 | ### Changed |
409 | ||
410 | - Refine pool information content. | |
b4213b7f | 411 | - Limit pool internals public exposure. |
89a4abfd | 412 | |
8a9febf5 JB |
413 | ## [2.5.2] - 2023-06-02 |
414 | ||
91ee39ed JB |
415 | ### Added |
416 | ||
417 | - Add `taskError` pool event for task execution error. | |
6b27d407 | 418 | - Add pool information `info` property to pool. |
91ee39ed JB |
419 | - Emit pool information on `busy` and `full` pool events. |
420 | ||
8babb151 JB |
421 | ## [2.5.1] - 2023-06-01 |
422 | ||
0e05c4dc JB |
423 | ### Added |
424 | ||
1f68cede | 425 | - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`. |
91ee39ed | 426 | - Add `error` pool event for uncaught worker error. |
0e05c4dc | 427 | |
a8766181 JB |
428 | ## [2.5.0] - 2023-05-31 |
429 | ||
e4543b14 JB |
430 | ### Added |
431 | ||
432 | - Switch pool event emitter to `EventEmitterAsyncResource`. | |
6da80d38 | 433 | - Add tasks wait time accounting in per worker tasks usage. |
5af9c0f7 | 434 | - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental). |
e4543b14 JB |
435 | |
436 | ### Changed | |
437 | ||
438 | - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`. | |
439 | ||
570efb11 JB |
440 | ## [2.4.14] - 2023-05-09 |
441 | ||
b0f28bad JB |
442 | ### Fixed |
443 | ||
444 | - Ensure no undefined task runtime can land in the tasks history. | |
445 | - Fix median computation implementation once again. | |
446 | ||
110b6d13 JB |
447 | ### Added |
448 | ||
449 | - Unit tests for median and queue implementations. | |
450 | ||
72584880 JB |
451 | ## [2.4.13] - 2023-05-08 |
452 | ||
b0d6ed8f JB |
453 | ### Fixed |
454 | ||
e3058615 | 455 | - Fix worker choice strategy options validation. |
b0d6ed8f JB |
456 | - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission. |
457 | ||
06140c32 JB |
458 | ## [2.4.12] - 2023-05-06 |
459 | ||
a86b6df1 JB |
460 | ### Added |
461 | ||
462 | - Support multiple task functions per worker. | |
08f3f44c | 463 | - Add custom worker weights support to worker choice strategies options. |
a86b6df1 | 464 | |
29ee7e9a JB |
465 | ### Changed |
466 | ||
467 | - Use O(1) queue implementation for tasks queueing. | |
468 | ||
0682ba15 JB |
469 | ### Fixed |
470 | ||
471 | - Fix median computation implementation. | |
472 | - Fix fair share worker choice strategy internals update. | |
473 | ||
936d53ec JB |
474 | ## [2.4.11] - 2023-04-23 |
475 | ||
cb70b19d JB |
476 | ### Changed |
477 | ||
478 | - Optimize free worker finding in worker choice strategies. | |
479 | ||
15bb637a JB |
480 | ## [2.4.10] - 2023-04-15 |
481 | ||
ef41a6e6 JB |
482 | ### Fixed |
483 | ||
82ea6492 | 484 | - Fix typescript type definition for task function: ensure the input data is optional. |
ef41a6e6 JB |
485 | - Fix typescript type definition for pool execute(): ensure the input data is optional. |
486 | ||
181eb2b4 JB |
487 | ## [2.4.9] - 2023-04-15 |
488 | ||
a20f0ba5 JB |
489 | ### Added |
490 | ||
491 | - Add tasks queue enablement runtime setter to pool. | |
492 | - Add tasks queue options runtime setter to pool. | |
493 | - Add worker choice strategy options runtime setter to pool. | |
494 | ||
495 | ### Changed | |
496 | ||
497 | - Remove the tasks queuing experimental status. | |
498 | ||
d4aeae5a JB |
499 | ### Fixed |
500 | ||
82ea6492 | 501 | - Fix task function type definition and validation. |
2fc5cae3 | 502 | - Fix worker choice strategy options handling. |
d4aeae5a | 503 | |
1d9e7023 JB |
504 | ## [2.4.8] - 2023-04-12 |
505 | ||
f9b4bbf8 JB |
506 | ### Fixed |
507 | ||
508 | - Fix message between main worker and worker type definition for tasks. | |
509 | - Fix code documentation. | |
510 | ||
12ae3210 JB |
511 | ## [2.4.7] - 2023-04-11 |
512 | ||
7171d33f JB |
513 | ### Added |
514 | ||
515 | - Add worker tasks queue options to pool options. | |
516 | ||
e8bd29ce JB |
517 | ### Fixed |
518 | ||
519 | - Fix missing documentation. | |
520 | ||
42c7bc10 JB |
521 | ## [2.4.6] - 2023-04-10 |
522 | ||
681196cc JB |
523 | ### Fixed |
524 | ||
525 | - Ensure one task at a time is executed per worker with tasks queueing enabled. | |
1c6fe997 | 526 | - Properly count worker executing tasks with tasks queueing enabled. |
681196cc | 527 | |
54d360e3 JB |
528 | ## [2.4.5] - 2023-04-09 |
529 | ||
3fafb1b2 JB |
530 | ### Added |
531 | ||
9e775f96 JB |
532 | - Use monotonic high resolution timer for worker tasks runtime. |
533 | - Add worker tasks median runtime to statistics. | |
ff733df7 | 534 | - Add worker tasks queue (experimental). |
3fafb1b2 | 535 | |
92fa3eb6 JB |
536 | ## [2.4.4] - 2023-04-07 |
537 | ||
aee46736 JB |
538 | ### Added |
539 | ||
540 | - Add `PoolEvents` enumeration and `PoolEvent` type. | |
541 | ||
36b5e78f JB |
542 | ### Fixed |
543 | ||
ff0c2b3e | 544 | - Destroy worker only on alive check. |
36b5e78f | 545 | |
9fb0f324 JB |
546 | ## [2.4.3] - 2023-04-07 |
547 | ||
28cf3617 JB |
548 | ### Fixed |
549 | ||
550 | - Fix typedoc generation with inheritance. | |
551 | ||
848f0f27 JB |
552 | ## [2.4.2] - 2023-04-06 |
553 | ||
164d950a JB |
554 | ### Added |
555 | ||
556 | - Add `full` event to dynamic pool. | |
32417142 | 557 | - Keep worker choice strategy in memory for conditional reuse. |
164d950a | 558 | |
78ab2555 JB |
559 | ### Fixed |
560 | ||
561 | - Fix possible negative worker key at worker removal in worker choice strategies. | |
562 | ||
79aafe9f JB |
563 | ## [2.4.1] - 2023-04-05 |
564 | ||
9cd39dd4 JB |
565 | ### Changed |
566 | ||
567 | - Optimize worker choice strategy for dynamic pool. | |
568 | ||
965415bb JB |
569 | ### Fixed |
570 | ||
571 | - Ensure dynamic pool does not alter worker choice strategy expected behavior. | |
572 | ||
d8b60b1c JB |
573 | ## [2.4.0] - 2023-04-04 |
574 | ||
c6bd2650 JB |
575 | ### Added |
576 | ||
577 | - Add `LESS_BUSY` worker choice strategy. | |
578 | ||
579 | ### Changed | |
580 | ||
581 | - Optimize worker storage in pool. | |
582 | - Optimize worker alive status check. | |
583 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
584 | - Optimize `LESS_USED` worker choice strategy. | |
585 | - Update benchmarks versus external threads pools. | |
586 | - Optimize tasks usage statistics requirements for worker choice strategy. | |
587 | ||
588 | ### Fixed | |
589 | ||
590 | - Ensure trimmable characters are checked at pool initialization. | |
591 | - Fix message id integer overflow. | |
592 | - Fix pool worker removal in worker choice strategy internals. | |
593 | - Fix package publication with pnpm. | |
594 | ||
d0a3f018 JB |
595 | ## [2.4.0-3] - 2023-04-04 |
596 | ||
b2ede285 JB |
597 | ### Added |
598 | ||
599 | - Add `LESS_BUSY` worker choice strategy. | |
600 | ||
601 | ### Changed | |
602 | ||
603 | - Optimize worker storage in pool. | |
604 | - Optimize worker alive status check. | |
605 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
606 | - Optimize `LESS_USED` worker choice strategy. | |
607 | - Update benchmarks versus external threads pools. | |
608 | ||
609 | ### Fixed | |
610 | ||
611 | - Ensure trimmable characters are checked at pool initialization. | |
612 | - Fix message id integer overflow. | |
613 | - Fix pool worker removal in worker choice strategy internals. | |
614 | - Fix package publication with pnpm. | |
615 | ||
a015ea40 JB |
616 | ## [2.4.0-2] - 2023-04-03 |
617 | ||
698f4bbc JB |
618 | ### Added |
619 | ||
620 | - Add `LESS_BUSY` worker choice strategy. | |
621 | ||
622 | ### Changed | |
623 | ||
624 | - Optimize worker storage in pool. | |
625 | - Optimize worker alive status check. | |
626 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
627 | - Optimize `LESS_USED` worker choice strategy. | |
628 | ||
629 | ### Fixed | |
630 | ||
631 | - Ensure trimmable characters are checked at pool initialization. | |
632 | - Fix message id integer overflow. | |
633 | - Fix pool worker removal in worker choice strategy internals. | |
634 | - Fix package publication with pnpm. | |
635 | ||
8fe15920 JB |
636 | ## [2.4.0-1] - 2023-04-03 |
637 | ||
5b301c28 JB |
638 | ### Added |
639 | ||
640 | - Add `LESS_BUSY` worker choice strategy. | |
641 | ||
642 | ### Changed | |
643 | ||
644 | - Optimize worker storage in pool. | |
645 | - Optimize worker alive status check. | |
646 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. | |
647 | - Optimize `LESS_USED` worker choice strategy. | |
648 | ||
649 | ### Fixed | |
650 | ||
651 | - Ensure trimmable characters are checked at pool initialization. | |
652 | - Fix message id integer overflow. | |
653 | - Fix pool worker removal in worker choice strategy internals. | |
654 | ||
2fb9ca9c JB |
655 | ## [2.4.0-0] - 2023-04-03 |
656 | ||
168c526f JB |
657 | ### Added |
658 | ||
659 | - Add `LESS_BUSY` worker choice strategy. | |
660 | ||
1d71a908 JB |
661 | ### Changed |
662 | ||
ffcbbad8 | 663 | - Optimize worker storage in pool. |
1d71a908 | 664 | - Optimize worker alive status check. |
65a60b3b | 665 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
737c6d97 | 666 | - Optimize `LESS_USED` worker choice strategy. |
1d71a908 | 667 | |
ffcbbad8 JB |
668 | ### Fixed |
669 | ||
670 | - Ensure trimmable characters are checked at pool initialization. | |
b4e75778 | 671 | - Fix message id integer overflow. |
97a2abc3 | 672 | - Fix pool worker removal in worker choice strategy internals. |
ffcbbad8 | 673 | |
08372738 JB |
674 | ## [2.3.10] - 2023-03-18 |
675 | ||
710826bc JB |
676 | ### Fixed |
677 | ||
9606b474 | 678 | - Fix package.json `exports` syntax for ESM and CommonJS. |
710826bc JB |
679 | |
680 | ### Changed | |
681 | ||
682 | - Permit SemVer pre-release publication. | |
76e5ac6f | 683 | |
e4796ecd JB |
684 | ## [2.3.10-2] - 2023-03-18 |
685 | ||
6abad580 JB |
686 | ### Fixed |
687 | ||
9606b474 | 688 | - Fix package.json `exports` syntax for ESM and CommonJS. |
6abad580 | 689 | |
a2ee98cc JB |
690 | ## [2.3.10-1] - 2023-03-18 |
691 | ||
7e060cee JB |
692 | ### Changed |
693 | ||
90483887 | 694 | - Permit SemVer pre-release publication. |
7e060cee | 695 | |
c81bfafb JB |
696 | ## [2.3.10-0] - 2023-03-18 |
697 | ||
fe18768d JB |
698 | ### Fixed |
699 | ||
9606b474 | 700 | - Fix package.json `exports` syntax for ESM and CommonJS. |
fe18768d | 701 | |
d7b78217 JB |
702 | ## [2.3.9] - 2023-03-18 |
703 | ||
ed6dd37f JB |
704 | ### Changed |
705 | ||
706 | - Introduce ESM module support along with CommonJS one. | |
707 | ||
708 | ### Fixed | |
709 | ||
710 | - Fix brown paper bag bug referencing the same object literal. | |
711 | ||
68e2ad86 JB |
712 | ## [2.3.8] - 2023-03-18 |
713 | ||
ca6c7d70 JB |
714 | ### Changed |
715 | ||
716 | - Switch internal benchmarking code to benny. | |
fbdedeb9 JB |
717 | - Switch to TypeScript 5.x.x. |
718 | - Switch rollup bundler plugins to core ones. | |
ed6dd37f | 719 | - Switch to TSDoc syntax. |
fbdedeb9 | 720 | - Enforce conventional commits. |
ca6c7d70 | 721 | |
d15211d4 JB |
722 | ### Fixed |
723 | ||
724 | - Fix random integer generator. | |
fbdedeb9 | 725 | - Fix worker choice strategy pool type identification at initialization. |
d15211d4 | 726 | |
995705ea JB |
727 | ## [2.3.7] - 2022-10-23 |
728 | ||
b953022b JB |
729 | ### Changed |
730 | ||
731 | - Switch to open collective FOSS project funding platform. | |
78cea37e JB |
732 | - Switch to ts-standard linter configuration on TypeScript code. |
733 | ||
734 | ### Fixed | |
735 | ||
736 | - Fixed missing async on pool execute method. | |
737 | - Fixed typing in TypeScript example. | |
738 | - Fixed types in unit tests. | |
b953022b | 739 | |
3b9f6953 JB |
740 | ## [2.3.6] - 2022-10-22 |
741 | ||
f80cead4 JB |
742 | ### Changed |
743 | ||
744 | - Cleanup pool attributes and methods. | |
745 | - Refine error types thrown. | |
746 | ||
747 | ### Fixed | |
748 | ||
749 | - Fix continuous integration build on windows. | |
750 | - Fix code coverage reporting by using c8 instead of nyc. | |
751 | ||
efc22107 JB |
752 | ## [2.3.5] - 2022-10-21 |
753 | ||
7a6a0a96 JB |
754 | ### Changed |
755 | ||
a05c10de JB |
756 | - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter. |
757 | - Optimize tasks usage lookup implementation. | |
7a6a0a96 | 758 | |
b4904890 JB |
759 | ### Fixed |
760 | ||
761 | - Fix missed pool event emitter type export. | |
762 | - Fix typedoc documentation generation. | |
763 | ||
a875f8d1 JB |
764 | ## [2.3.4] - 2022-10-17 |
765 | ||
73cda448 JB |
766 | ### Added |
767 | ||
768 | - Fully automate release process with release-it. | |
769 | ||
45a5a54c JB |
770 | ### Changed |
771 | ||
73cda448 | 772 | - Optimize fair share task scheduling algorithm implementation. |
eb4a8a82 | 773 | - Update benchmarks versus external pools results with latest version. |
45a5a54c | 774 | |
90ee1b18 | 775 | ## [2.3.3] - 2022-10-15 |
1a76932b JB |
776 | |
777 | ### Added | |
778 | ||
779 | - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options. | |
780 | ||
90ee1b18 | 781 | ## [2.3.2] - 2022-10-14 |
11df3590 JB |
782 | |
783 | ### Changed | |
784 | ||
785 | - Optimize fair share worker selection strategy implementation. | |
786 | ||
787 | ### Fixed | |
788 | ||
789 | - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled. | |
790 | ||
90ee1b18 | 791 | ## [2.3.1] - 2022-10-13 |
23ff945a JB |
792 | |
793 | ### Added | |
794 | ||
795 | - Pool worker choice strategies: | |
796 | - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now. | |
797 | - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now. | |
798 | ||
90ee1b18 | 799 | ## [2.2.2] - 2022-10-09 |
cb2b6c69 JB |
800 | |
801 | ### Fixed | |
802 | ||
803 | - Fixed `README.md` file. | |
804 | ||
90ee1b18 | 805 | ## [2.2.1] - 2022-10-08 |
bdacc2d2 | 806 | |
bdaf31cd JB |
807 | ### Added |
808 | ||
809 | - Dynamic worker choice strategy change at runtime. | |
bdacc2d2 | 810 | |
90ee1b18 | 811 | ## [2.2.0] - 2022-01-05 |
7e0d447f JB |
812 | |
813 | ### Breaking Changes | |
814 | ||
9606b474 | 815 | - Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version. |
7e0d447f | 816 | |
90ee1b18 | 817 | ## [2.1.0] - 2021-08-29 |
35cf1c03 JB |
818 | |
819 | ### Added | |
820 | ||
821 | - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker. | |
e088a00c JB |
822 | |
823 | ### Breaking Changes | |
824 | ||
825 | - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute. | |
826 | - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`. | |
827 | - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`. | |
c365b2d3 | 828 | - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker. |
e088a00c | 829 | |
90ee1b18 | 830 | ## [2.0.2] - 2021-05-12 |
14916bf9 JB |
831 | |
832 | ### Bug fixes | |
833 | ||
834 | - Fix `busy` event emission on fixed pool type | |
835 | ||
90ee1b18 | 836 | ## [2.0.1] - 2021-03-16 |
7f685093 JB |
837 | |
838 | ### Bug fixes | |
839 | ||
840 | - Check if pool options are properly set. | |
841 | - `busy` event is emitted on all pool types. | |
842 | ||
90ee1b18 | 843 | ## [2.0.0] - 2021-03-01 |
fa0f5b28 | 844 | |
f3f833ab | 845 | ### Bug fixes |
d63d3be3 | 846 | |
ddbeaffd | 847 | - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70). |
d63d3be3 | 848 | |
fa0f5b28 S |
849 | ### Breaking Changes |
850 | ||
7f685093 | 851 | - `FullPool` event is now renamed to `busy`. |
1927ee67 | 852 | - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`. |
1a81f8af | 853 | _Find more details on our JSDoc._ |
ddbeaffd | 854 | |
1927ee67 APA |
855 | - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed. |
856 | ||
ddbeaffd | 857 | - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes. |
fa0f5b28 | 858 | |
ec2ccfc8 JB |
859 | ### Pool options types declaration merge |
860 | ||
861 | `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`. | |
862 | ||
fa0f5b28 S |
863 | #### New `export` strategy |
864 | ||
865 | ```js | |
866 | // Before | |
0eee77cb | 867 | const DynamicThreadPool = require('poolifier/lib/dynamic') |
fa0f5b28 | 868 | // After |
0eee77cb | 869 | const { DynamicThreadPool } = require('poolifier/lib/dynamic') |
fa0f5b28 S |
870 | ``` |
871 | ||
872 | But you should always prefer just using | |
873 | ||
874 | ```js | |
0eee77cb | 875 | const { DynamicThreadPool } = require('poolifier') |
fa0f5b28 S |
876 | ``` |
877 | ||
d3c8a1a8 S |
878 | #### New type definitions for input data and response |
879 | ||
6677a3d3 | 880 | For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data. |
9606b474 | 881 | _This is not a limitation by poolifier but Node.js._ |
d3c8a1a8 | 882 | |
3a4b605f | 883 | #### Public property replacements |
5c5a1fb7 | 884 | |
3a4b605f | 885 | `numWorkers` property is now `numberOfWorkers` |
5c5a1fb7 | 886 | |
280c2a77 | 887 | #### Internal (protected) properties and methods renaming |
fa0f5b28 | 888 | |
280c2a77 S |
889 | These properties are not intended for end users |
890 | ||
891 | - `id` => `nextMessageId` | |
892 | ||
893 | These methods are not intended for end users | |
fa0f5b28 S |
894 | |
895 | - `_chooseWorker` => `chooseWorker` | |
280c2a77 | 896 | - `_newWorker` => `createWorker` |
fa0f5b28 S |
897 | - `_execute` => `internalExecute` |
898 | - `_chooseWorker` => `chooseWorker` | |
899 | - `_checkAlive` => `checkAlive` | |
900 | - `_run` => `run` | |
901 | - `_runAsync` => `runAsync` | |
902 | ||
90ee1b18 | 903 | ## [1.1.0] - 2020-05-21 |
0312f71a APA |
904 | |
905 | ### Added | |
906 | ||
907 | - ThreadWorker support async functions as option | |
cf9aa6c3 | 908 | - Various external library patches |
0312f71a | 909 | |
90ee1b18 | 910 | ## [1.0.0] - 2020-01-24 |
522eea03 | 911 | |
912 | ### Added | |
913 | ||
914 | - FixedThreadPool implementation | |
915 | - DynamicThreadPool implementation | |
0312f71a | 916 | - WorkerThread implementation to improve developer experience |