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