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