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