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