| 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 | ### Changed |
| 11 | |
| 12 | - Use O(1) queue implementation for tasks queueing. |
| 13 | |
| 14 | ## [2.4.11] - 2023-04-23 |
| 15 | |
| 16 | ### Changed |
| 17 | |
| 18 | - Optimize free worker finding in worker choice strategies. |
| 19 | |
| 20 | ## [2.4.10] - 2023-04-15 |
| 21 | |
| 22 | ### Fixed |
| 23 | |
| 24 | - Fix typescript type definition for worker function: ensure the input data is optional. |
| 25 | - Fix typescript type definition for pool execute(): ensure the input data is optional. |
| 26 | |
| 27 | ## [2.4.9] - 2023-04-15 |
| 28 | |
| 29 | ### Added |
| 30 | |
| 31 | - Add tasks queue enablement runtime setter to pool. |
| 32 | - Add tasks queue options runtime setter to pool. |
| 33 | - Add worker choice strategy options runtime setter to pool. |
| 34 | |
| 35 | ### Changed |
| 36 | |
| 37 | - Remove the tasks queuing experimental status. |
| 38 | |
| 39 | ### Fixed |
| 40 | |
| 41 | - Fix worker function type definition and validation. |
| 42 | - Fix worker choice strategy options handling. |
| 43 | |
| 44 | ## [2.4.8] - 2023-04-12 |
| 45 | |
| 46 | ### Fixed |
| 47 | |
| 48 | - Fix message between main worker and worker type definition for tasks. |
| 49 | - Fix code documentation. |
| 50 | |
| 51 | ## [2.4.7] - 2023-04-11 |
| 52 | |
| 53 | ### Added |
| 54 | |
| 55 | - Add worker tasks queue options to pool options. |
| 56 | |
| 57 | ### Fixed |
| 58 | |
| 59 | - Fix missing documentation. |
| 60 | |
| 61 | ## [2.4.6] - 2023-04-10 |
| 62 | |
| 63 | ### Fixed |
| 64 | |
| 65 | - Ensure one task at a time is executed per worker with tasks queueing enabled. |
| 66 | - Properly count worker running tasks with tasks queueing enabled. |
| 67 | |
| 68 | ## [2.4.5] - 2023-04-09 |
| 69 | |
| 70 | ### Added |
| 71 | |
| 72 | - Use monotonic high resolution timer for worker tasks run time. |
| 73 | - Add worker tasks median run time to statistics. |
| 74 | - Add worker tasks queue (experimental). |
| 75 | |
| 76 | ## [2.4.4] - 2023-04-07 |
| 77 | |
| 78 | ### Added |
| 79 | |
| 80 | - Add `PoolEvents` enumeration and `PoolEvent` type. |
| 81 | |
| 82 | ### Fixed |
| 83 | |
| 84 | - Destroy worker only on alive check. |
| 85 | |
| 86 | ## [2.4.3] - 2023-04-07 |
| 87 | |
| 88 | ### Fixed |
| 89 | |
| 90 | - Fix typedoc generation with inheritance. |
| 91 | |
| 92 | ## [2.4.2] - 2023-04-06 |
| 93 | |
| 94 | ### Added |
| 95 | |
| 96 | - Add `full` event to dynamic pool. |
| 97 | - Keep worker choice strategy in memory for conditional reuse. |
| 98 | |
| 99 | ### Fixed |
| 100 | |
| 101 | - Fix possible negative worker key at worker removal in worker choice strategies. |
| 102 | |
| 103 | ## [2.4.1] - 2023-04-05 |
| 104 | |
| 105 | ### Changed |
| 106 | |
| 107 | - Optimize worker choice strategy for dynamic pool. |
| 108 | |
| 109 | ### Fixed |
| 110 | |
| 111 | - Ensure dynamic pool does not alter worker choice strategy expected behavior. |
| 112 | |
| 113 | ## [2.4.0] - 2023-04-04 |
| 114 | |
| 115 | ### Added |
| 116 | |
| 117 | - Add `LESS_BUSY` worker choice strategy. |
| 118 | |
| 119 | ### Changed |
| 120 | |
| 121 | - Optimize worker storage in pool. |
| 122 | - Optimize worker alive status check. |
| 123 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 124 | - Optimize `LESS_USED` worker choice strategy. |
| 125 | - Update benchmarks versus external threads pools. |
| 126 | - Optimize tasks usage statistics requirements for worker choice strategy. |
| 127 | |
| 128 | ### Fixed |
| 129 | |
| 130 | - Ensure trimmable characters are checked at pool initialization. |
| 131 | - Fix message id integer overflow. |
| 132 | - Fix pool worker removal in worker choice strategy internals. |
| 133 | - Fix package publication with pnpm. |
| 134 | |
| 135 | ## [2.4.0-3] - 2023-04-04 |
| 136 | |
| 137 | ### Added |
| 138 | |
| 139 | - Add `LESS_BUSY` worker choice strategy. |
| 140 | |
| 141 | ### Changed |
| 142 | |
| 143 | - Optimize worker storage in pool. |
| 144 | - Optimize worker alive status check. |
| 145 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 146 | - Optimize `LESS_USED` worker choice strategy. |
| 147 | - Update benchmarks versus external threads pools. |
| 148 | |
| 149 | ### Fixed |
| 150 | |
| 151 | - Ensure trimmable characters are checked at pool initialization. |
| 152 | - Fix message id integer overflow. |
| 153 | - Fix pool worker removal in worker choice strategy internals. |
| 154 | - Fix package publication with pnpm. |
| 155 | |
| 156 | ## [2.4.0-2] - 2023-04-03 |
| 157 | |
| 158 | ### Added |
| 159 | |
| 160 | - Add `LESS_BUSY` worker choice strategy. |
| 161 | |
| 162 | ### Changed |
| 163 | |
| 164 | - Optimize worker storage in pool. |
| 165 | - Optimize worker alive status check. |
| 166 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 167 | - Optimize `LESS_USED` worker choice strategy. |
| 168 | |
| 169 | ### Fixed |
| 170 | |
| 171 | - Ensure trimmable characters are checked at pool initialization. |
| 172 | - Fix message id integer overflow. |
| 173 | - Fix pool worker removal in worker choice strategy internals. |
| 174 | - Fix package publication with pnpm. |
| 175 | |
| 176 | ## [2.4.0-1] - 2023-04-03 |
| 177 | |
| 178 | ### Added |
| 179 | |
| 180 | - Add `LESS_BUSY` worker choice strategy. |
| 181 | |
| 182 | ### Changed |
| 183 | |
| 184 | - Optimize worker storage in pool. |
| 185 | - Optimize worker alive status check. |
| 186 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 187 | - Optimize `LESS_USED` worker choice strategy. |
| 188 | |
| 189 | ### Fixed |
| 190 | |
| 191 | - Ensure trimmable characters are checked at pool initialization. |
| 192 | - Fix message id integer overflow. |
| 193 | - Fix pool worker removal in worker choice strategy internals. |
| 194 | |
| 195 | ## [2.4.0-0] - 2023-04-03 |
| 196 | |
| 197 | ### Added |
| 198 | |
| 199 | - Add `LESS_BUSY` worker choice strategy. |
| 200 | |
| 201 | ### Changed |
| 202 | |
| 203 | - Optimize worker storage in pool. |
| 204 | - Optimize worker alive status check. |
| 205 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 206 | - Optimize `LESS_USED` worker choice strategy. |
| 207 | |
| 208 | ### Fixed |
| 209 | |
| 210 | - Ensure trimmable characters are checked at pool initialization. |
| 211 | - Fix message id integer overflow. |
| 212 | - Fix pool worker removal in worker choice strategy internals. |
| 213 | |
| 214 | ## [2.3.10] - 2023-03-18 |
| 215 | |
| 216 | ### Fixed |
| 217 | |
| 218 | - Fix `exports` syntax for ESM and CommonJS. |
| 219 | |
| 220 | ### Changed |
| 221 | |
| 222 | - Permit SemVer pre-release publication. |
| 223 | |
| 224 | ## [2.3.10-2] - 2023-03-18 |
| 225 | |
| 226 | ### Fixed |
| 227 | |
| 228 | - Fix `exports` syntax for ESM and CommonJS. |
| 229 | |
| 230 | ## [2.3.10-1] - 2023-03-18 |
| 231 | |
| 232 | ### Changed |
| 233 | |
| 234 | - Permit SemVer pre-release publication. |
| 235 | |
| 236 | ## [2.3.10-0] - 2023-03-18 |
| 237 | |
| 238 | ### Fixed |
| 239 | |
| 240 | - Fix `exports` syntax for ESM and CommonJS. |
| 241 | |
| 242 | ## [2.3.9] - 2023-03-18 |
| 243 | |
| 244 | ### Changed |
| 245 | |
| 246 | - Introduce ESM module support along with CommonJS one. |
| 247 | |
| 248 | ### Fixed |
| 249 | |
| 250 | - Fix brown paper bag bug referencing the same object literal. |
| 251 | |
| 252 | ## [2.3.8] - 2023-03-18 |
| 253 | |
| 254 | ### Changed |
| 255 | |
| 256 | - Switch internal benchmarking code to benny. |
| 257 | - Switch to TypeScript 5.x.x. |
| 258 | - Switch rollup bundler plugins to core ones. |
| 259 | - Switch to TSDoc syntax. |
| 260 | - Enforce conventional commits. |
| 261 | |
| 262 | ### Fixed |
| 263 | |
| 264 | - Fix random integer generator. |
| 265 | - Fix worker choice strategy pool type identification at initialization. |
| 266 | |
| 267 | ## [2.3.7] - 2022-10-23 |
| 268 | |
| 269 | ### Changed |
| 270 | |
| 271 | - Switch to open collective FOSS project funding platform. |
| 272 | - Switch to ts-standard linter configuration on TypeScript code. |
| 273 | |
| 274 | ### Fixed |
| 275 | |
| 276 | - Fixed missing async on pool execute method. |
| 277 | - Fixed typing in TypeScript example. |
| 278 | - Fixed types in unit tests. |
| 279 | |
| 280 | ## [2.3.6] - 2022-10-22 |
| 281 | |
| 282 | ### Changed |
| 283 | |
| 284 | - Cleanup pool attributes and methods. |
| 285 | - Refine error types thrown. |
| 286 | |
| 287 | ### Fixed |
| 288 | |
| 289 | - Fix continuous integration build on windows. |
| 290 | - Fix code coverage reporting by using c8 instead of nyc. |
| 291 | |
| 292 | ## [2.3.5] - 2022-10-21 |
| 293 | |
| 294 | ### Changed |
| 295 | |
| 296 | - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter. |
| 297 | - Optimize tasks usage lookup implementation. |
| 298 | |
| 299 | ### Fixed |
| 300 | |
| 301 | - Fix missed pool event emitter type export. |
| 302 | - Fix typedoc documentation generation. |
| 303 | |
| 304 | ## [2.3.4] - 2022-10-17 |
| 305 | |
| 306 | ### Added |
| 307 | |
| 308 | - Fully automate release process with release-it. |
| 309 | |
| 310 | ### Changed |
| 311 | |
| 312 | - Optimize fair share task scheduling algorithm implementation. |
| 313 | - Update benchmarks versus external pools results with latest version. |
| 314 | |
| 315 | ## [2.3.3] - 2022-10-15 |
| 316 | |
| 317 | ### Added |
| 318 | |
| 319 | - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options. |
| 320 | |
| 321 | ## [2.3.2] - 2022-10-14 |
| 322 | |
| 323 | ### Changed |
| 324 | |
| 325 | - Optimize fair share worker selection strategy implementation. |
| 326 | |
| 327 | ### Fixed |
| 328 | |
| 329 | - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled. |
| 330 | |
| 331 | ## [2.3.1] - 2022-10-13 |
| 332 | |
| 333 | ### Added |
| 334 | |
| 335 | - Pool worker choice strategies: |
| 336 | - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now. |
| 337 | - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now. |
| 338 | |
| 339 | ## [2.2.2] - 2022-10-09 |
| 340 | |
| 341 | ### Fixed |
| 342 | |
| 343 | - Fixed `README.md` file. |
| 344 | |
| 345 | ## [2.2.1] - 2022-10-08 |
| 346 | |
| 347 | ### Added |
| 348 | |
| 349 | - Dynamic worker choice strategy change at runtime. |
| 350 | |
| 351 | ## [2.2.0] - 2022-01-05 |
| 352 | |
| 353 | ### Breaking Changes |
| 354 | |
| 355 | - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version. |
| 356 | |
| 357 | ## [2.1.0] - 2021-08-29 |
| 358 | |
| 359 | ### Added |
| 360 | |
| 361 | - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker. |
| 362 | |
| 363 | ### Breaking Changes |
| 364 | |
| 365 | - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute. |
| 366 | - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`. |
| 367 | - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`. |
| 368 | - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker. |
| 369 | |
| 370 | ## [2.0.2] - 2021-05-12 |
| 371 | |
| 372 | ### Bug fixes |
| 373 | |
| 374 | - Fix `busy` event emission on fixed pool type |
| 375 | |
| 376 | ## [2.0.1] - 2021-03-16 |
| 377 | |
| 378 | ### Bug fixes |
| 379 | |
| 380 | - Check if pool options are properly set. |
| 381 | - `busy` event is emitted on all pool types. |
| 382 | |
| 383 | ## [2.0.0] - 2021-03-01 |
| 384 | |
| 385 | ### Bug fixes |
| 386 | |
| 387 | - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70). |
| 388 | |
| 389 | ### Breaking Changes |
| 390 | |
| 391 | - `FullPool` event is now renamed to `busy`. |
| 392 | - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`. |
| 393 | _Find more details on our JSDoc._ |
| 394 | |
| 395 | - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed. |
| 396 | |
| 397 | - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes. |
| 398 | |
| 399 | ### Pool options types declaration merge |
| 400 | |
| 401 | `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`. |
| 402 | |
| 403 | #### New `export` strategy |
| 404 | |
| 405 | ```js |
| 406 | // Before |
| 407 | const DynamicThreadPool = require('poolifier/lib/dynamic') |
| 408 | // After |
| 409 | const { DynamicThreadPool } = require('poolifier/lib/dynamic') |
| 410 | ``` |
| 411 | |
| 412 | But you should always prefer just using |
| 413 | |
| 414 | ```js |
| 415 | const { DynamicThreadPool } = require('poolifier') |
| 416 | ``` |
| 417 | |
| 418 | #### New type definitions for input data and response |
| 419 | |
| 420 | For cluster worker and worker-thread pools, you can now only send and receive serializable data. |
| 421 | _This is not a limitation by poolifier but NodeJS._ |
| 422 | |
| 423 | #### Public property replacements |
| 424 | |
| 425 | `numWorkers` property is now `numberOfWorkers` |
| 426 | |
| 427 | #### Internal (protected) properties and methods renaming |
| 428 | |
| 429 | These properties are not intended for end users |
| 430 | |
| 431 | - `id` => `nextMessageId` |
| 432 | |
| 433 | These methods are not intended for end users |
| 434 | |
| 435 | - `_chooseWorker` => `chooseWorker` |
| 436 | - `_newWorker` => `createWorker` |
| 437 | - `_execute` => `internalExecute` |
| 438 | - `_chooseWorker` => `chooseWorker` |
| 439 | - `_checkAlive` => `checkAlive` |
| 440 | - `_run` => `run` |
| 441 | - `_runAsync` => `runAsync` |
| 442 | |
| 443 | ## [1.1.0] - 2020-05-21 |
| 444 | |
| 445 | ### Added |
| 446 | |
| 447 | - ThreadWorker support async functions as option |
| 448 | - Various external library patches |
| 449 | |
| 450 | ## [1.0.0] - 2020-01-24 |
| 451 | |
| 452 | ### Added |
| 453 | |
| 454 | - FixedThreadPool implementation |
| 455 | - DynamicThreadPool implementation |
| 456 | - WorkerThread implementation to improve developer experience |