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