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