24796774fd48bbb3850df0787d4a5b1f9fc00803
[poolifier.git] / CHANGELOG.md
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 ## [Unreleased]
9
10 ### Changed
11
12 - Switch internal benchmarking code to benny.
13
14 ### Fixed
15
16 - Fix random integer generator.
17
18 ## [2.3.7] - 2022-10-23
19
20 ### Changed
21
22 - Switch to open collective FOSS project funding platform.
23 - Switch to ts-standard linter configuration on TypeScript code.
24
25 ### Fixed
26
27 - Fixed missing async on pool execute method.
28 - Fixed typing in TypeScript example.
29 - Fixed types in unit tests.
30
31 ## [2.3.6] - 2022-10-22
32
33 ### Changed
34
35 - Cleanup pool attributes and methods.
36 - Refine error types thrown.
37
38 ### Fixed
39
40 - Fix continuous integration build on windows.
41 - Fix code coverage reporting by using c8 instead of nyc.
42
43 ## [2.3.5] - 2022-10-21
44
45 ### Changed
46
47 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
48 - Optimize tasks usage lookup implementation.
49
50 ### Fixed
51
52 - Fix missed pool event emitter type export.
53 - Fix typedoc documentation generation.
54
55 ## [2.3.4] - 2022-10-17
56
57 ### Added
58
59 - Fully automate release process with release-it.
60
61 ### Changed
62
63 - Optimize fair share task scheduling algorithm implementation.
64 - Update benchmarks versus external pools results with latest version.
65
66 ## [2.3.3] - 2022-10-15
67
68 ### Added
69
70 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
71
72 ## [2.3.2] - 2022-10-14
73
74 ### Changed
75
76 - Optimize fair share worker selection strategy implementation.
77
78 ### Fixed
79
80 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
81
82 ## [2.3.1] - 2022-10-13
83
84 ### Added
85
86 - Pool worker choice strategies:
87 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
88 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
89
90 ## [2.2.2] - 2022-10-09
91
92 ### Fixed
93
94 - Fixed `README.md` file.
95
96 ## [2.2.1] - 2022-10-08
97
98 ### Added
99
100 - Dynamic worker choice strategy change at runtime.
101
102 ## [2.2.0] - 2022-01-05
103
104 ### Breaking Changes
105
106 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
107
108 ## [2.1.0] - 2021-08-29
109
110 ### Added
111
112 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
113
114 ### Breaking Changes
115
116 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
117 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
118 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
119 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
120
121 ## [2.0.2] - 2021-05-12
122
123 ### Bug fixes
124
125 - Fix `busy` event emission on fixed pool type
126
127 ## [2.0.1] - 2021-03-16
128
129 ### Bug fixes
130
131 - Check if pool options are properly set.
132 - `busy` event is emitted on all pool types.
133
134 ## [2.0.0] - 2021-03-01
135
136 ### Bug fixes
137
138 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
139
140 ### Breaking Changes
141
142 - `FullPool` event is now renamed to `busy`.
143 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
144 _Find more details on our JSDoc._
145
146 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
147
148 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
149
150 ### Pool options types declaration merge
151
152 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
153
154 #### New `export` strategy
155
156 ```js
157 // Before
158 const DynamicThreadPool = require('poolifier/lib/dynamic')
159 // After
160 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
161 ```
162
163 But you should always prefer just using
164
165 ```js
166 const { DynamicThreadPool } = require('poolifier')
167 ```
168
169 #### New type definitions for input data and response
170
171 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
172 _This is not a limitation by poolifier but NodeJS._
173
174 #### Public property replacements
175
176 `numWorkers` property is now `numberOfWorkers`
177
178 #### Internal (protected) properties and methods renaming
179
180 These properties are not intended for end users
181
182 - `id` => `nextMessageId`
183
184 These methods are not intended for end users
185
186 - `_chooseWorker` => `chooseWorker`
187 - `_newWorker` => `createWorker`
188 - `_execute` => `internalExecute`
189 - `_chooseWorker` => `chooseWorker`
190 - `_checkAlive` => `checkAlive`
191 - `_run` => `run`
192 - `_runAsync` => `runAsync`
193
194 ## [1.1.0] - 2020-05-21
195
196 ### Added
197
198 - ThreadWorker support async functions as option
199 - Various external library patches
200
201 ## [1.0.0] - 2020-01-24
202
203 ### Added
204
205 - FixedThreadPool implementation
206 - DynamicThreadPool implementation
207 - WorkerThread implementation to improve developer experience