| 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.0.0/), |
| 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | |
| 8 | ## [2.1.0] - 2021-29-08 |
| 9 | |
| 10 | ### Added |
| 11 | |
| 12 | - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker. |
| 13 | |
| 14 | ### Breaking Changes |
| 15 | |
| 16 | - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute. |
| 17 | - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`. |
| 18 | - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`. |
| 19 | - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker. |
| 20 | |
| 21 | ## [2.0.2] - 2021-12-05 |
| 22 | |
| 23 | ### Bug fixes |
| 24 | |
| 25 | - Fix `busy` event emission on fixed pool type |
| 26 | |
| 27 | ## [2.0.1] - 2021-16-03 |
| 28 | |
| 29 | ### Bug fixes |
| 30 | |
| 31 | - Check if pool options are properly set. |
| 32 | - `busy` event is emitted on all pool types. |
| 33 | |
| 34 | ## [2.0.0] - 2021-01-03 |
| 35 | |
| 36 | ### Bug fixes |
| 37 | |
| 38 | - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70). |
| 39 | |
| 40 | ### Breaking Changes |
| 41 | |
| 42 | - `FullPool` event is now renamed to `busy`. |
| 43 | - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`. |
| 44 | _Find more details on our JSDoc._ |
| 45 | |
| 46 | - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed. |
| 47 | |
| 48 | - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes. |
| 49 | |
| 50 | ### Pool options types declaration merge |
| 51 | |
| 52 | `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`. |
| 53 | |
| 54 | #### New `export` strategy |
| 55 | |
| 56 | ```js |
| 57 | // Before |
| 58 | const DynamicThreadPool = require('poolifier/lib/dynamic') |
| 59 | // After |
| 60 | const { DynamicThreadPool } = require('poolifier/lib/dynamic') |
| 61 | ``` |
| 62 | |
| 63 | But you should always prefer just using |
| 64 | |
| 65 | ```js |
| 66 | const { DynamicThreadPool } = require('poolifier') |
| 67 | ``` |
| 68 | |
| 69 | #### New type definitions for input data and response |
| 70 | |
| 71 | For cluster worker and worker-thread pools, you can now only send and receive serializable data. |
| 72 | _This is not a limitation by poolifier but NodeJS._ |
| 73 | |
| 74 | #### Public property replacements |
| 75 | |
| 76 | `numWorkers` property is now `numberOfWorkers` |
| 77 | |
| 78 | #### Internal (protected) properties and methods renaming |
| 79 | |
| 80 | These properties are not intended for end users |
| 81 | |
| 82 | - `id` => `nextMessageId` |
| 83 | |
| 84 | These methods are not intended for end users |
| 85 | |
| 86 | - `_chooseWorker` => `chooseWorker` |
| 87 | - `_newWorker` => `createWorker` |
| 88 | - `_execute` => `internalExecute` |
| 89 | - `_chooseWorker` => `chooseWorker` |
| 90 | - `_checkAlive` => `checkAlive` |
| 91 | - `_run` => `run` |
| 92 | - `_runAsync` => `runAsync` |
| 93 | |
| 94 | ## [1.1.0] - 2020-21-05 |
| 95 | |
| 96 | ### Added |
| 97 | |
| 98 | - ThreadWorker support async functions as option |
| 99 | - Various external library patches |
| 100 | |
| 101 | ## [1.0.0] - 2020-24-01 |
| 102 | |
| 103 | ### Added |
| 104 | |
| 105 | - FixedThreadPool implementation |
| 106 | - DynamicThreadPool implementation |
| 107 | - WorkerThread implementation to improve developer experience |