refactor: rename a worker choice strategy
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c
JB
8## [Unreleased]
9
1d71a908
JB
10### Changed
11
ffcbbad8 12- Optimize worker storage in pool.
1d71a908 13- Optimize worker alive status check.
737c6d97
JB
14- Rename worker choice strategy `LESS_RECENTLY_USED to `LESS_USED` .
15- Optimize `LESS_USED` worker choice strategy.
1d71a908 16
ffcbbad8
JB
17### Fixed
18
19- Ensure trimmable characters are checked at pool initialization.
b4e75778 20- Fix message id integer overflow.
ffcbbad8 21
08372738
JB
22## [2.3.10] - 2023-03-18
23
710826bc
JB
24### Fixed
25
26- Fix `exports` syntax for ESM and CommonJS.
27
28### Changed
29
30- Permit SemVer pre-release publication.
76e5ac6f 31
e4796ecd
JB
32## [2.3.10-2] - 2023-03-18
33
6abad580
JB
34### Fixed
35
36- Fix `exports` syntax for ESM and CommonJS.
37
a2ee98cc
JB
38## [2.3.10-1] - 2023-03-18
39
7e060cee
JB
40### Changed
41
90483887 42- Permit SemVer pre-release publication.
7e060cee 43
c81bfafb
JB
44## [2.3.10-0] - 2023-03-18
45
fe18768d
JB
46### Fixed
47
48- Fix `exports` syntax for ESM and CommonJS.
49
d7b78217
JB
50## [2.3.9] - 2023-03-18
51
ed6dd37f
JB
52### Changed
53
54- Introduce ESM module support along with CommonJS one.
55
56### Fixed
57
58- Fix brown paper bag bug referencing the same object literal.
59
68e2ad86
JB
60## [2.3.8] - 2023-03-18
61
ca6c7d70
JB
62### Changed
63
64- Switch internal benchmarking code to benny.
fbdedeb9
JB
65- Switch to TypeScript 5.x.x.
66- Switch rollup bundler plugins to core ones.
ed6dd37f 67- Switch to TSDoc syntax.
fbdedeb9 68- Enforce conventional commits.
ca6c7d70 69
d15211d4
JB
70### Fixed
71
72- Fix random integer generator.
fbdedeb9 73- Fix worker choice strategy pool type identification at initialization.
d15211d4 74
995705ea
JB
75## [2.3.7] - 2022-10-23
76
b953022b
JB
77### Changed
78
79- Switch to open collective FOSS project funding platform.
78cea37e
JB
80- Switch to ts-standard linter configuration on TypeScript code.
81
82### Fixed
83
84- Fixed missing async on pool execute method.
85- Fixed typing in TypeScript example.
86- Fixed types in unit tests.
b953022b 87
3b9f6953
JB
88## [2.3.6] - 2022-10-22
89
f80cead4
JB
90### Changed
91
92- Cleanup pool attributes and methods.
93- Refine error types thrown.
94
95### Fixed
96
97- Fix continuous integration build on windows.
98- Fix code coverage reporting by using c8 instead of nyc.
99
efc22107
JB
100## [2.3.5] - 2022-10-21
101
7a6a0a96
JB
102### Changed
103
a05c10de
JB
104- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
105- Optimize tasks usage lookup implementation.
7a6a0a96 106
b4904890
JB
107### Fixed
108
109- Fix missed pool event emitter type export.
110- Fix typedoc documentation generation.
111
a875f8d1
JB
112## [2.3.4] - 2022-10-17
113
73cda448
JB
114### Added
115
116- Fully automate release process with release-it.
117
45a5a54c
JB
118### Changed
119
73cda448 120- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 121- Update benchmarks versus external pools results with latest version.
45a5a54c 122
90ee1b18 123## [2.3.3] - 2022-10-15
1a76932b
JB
124
125### Added
126
127- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
128
90ee1b18 129## [2.3.2] - 2022-10-14
11df3590
JB
130
131### Changed
132
133- Optimize fair share worker selection strategy implementation.
134
135### Fixed
136
137- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
138
90ee1b18 139## [2.3.1] - 2022-10-13
23ff945a
JB
140
141### Added
142
143- Pool worker choice strategies:
144 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
145 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
146
90ee1b18 147## [2.2.2] - 2022-10-09
cb2b6c69
JB
148
149### Fixed
150
151- Fixed `README.md` file.
152
90ee1b18 153## [2.2.1] - 2022-10-08
bdacc2d2 154
bdaf31cd
JB
155### Added
156
157- Dynamic worker choice strategy change at runtime.
bdacc2d2 158
90ee1b18 159## [2.2.0] - 2022-01-05
7e0d447f
JB
160
161### Breaking Changes
162
163- Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
164
90ee1b18 165## [2.1.0] - 2021-08-29
35cf1c03
JB
166
167### Added
168
169- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
170
171### Breaking Changes
172
173- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
174- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
175- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 176- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 177
90ee1b18 178## [2.0.2] - 2021-05-12
14916bf9
JB
179
180### Bug fixes
181
182- Fix `busy` event emission on fixed pool type
183
90ee1b18 184## [2.0.1] - 2021-03-16
7f685093
JB
185
186### Bug fixes
187
188- Check if pool options are properly set.
189- `busy` event is emitted on all pool types.
190
90ee1b18 191## [2.0.0] - 2021-03-01
fa0f5b28 192
f3f833ab 193### Bug fixes
d63d3be3 194
ddbeaffd 195- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 196
fa0f5b28
S
197### Breaking Changes
198
7f685093 199- `FullPool` event is now renamed to `busy`.
1927ee67 200- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 201 _Find more details on our JSDoc._
ddbeaffd 202
1927ee67
APA
203- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
204
ddbeaffd 205- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 206
ec2ccfc8
JB
207### Pool options types declaration merge
208
209`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
210
fa0f5b28
S
211#### New `export` strategy
212
213```js
214// Before
777b7824 215const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 216// After
777b7824 217const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
218```
219
220But you should always prefer just using
221
222```js
777b7824 223const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
224```
225
d3c8a1a8
S
226#### New type definitions for input data and response
227
ec2ccfc8 228For cluster worker and worker-thread pools, you can now only send and receive serializable data.
d3c8a1a8
S
229_This is not a limitation by poolifier but NodeJS._
230
3a4b605f 231#### Public property replacements
5c5a1fb7 232
3a4b605f 233`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 234
280c2a77 235#### Internal (protected) properties and methods renaming
fa0f5b28 236
280c2a77
S
237These properties are not intended for end users
238
239- `id` => `nextMessageId`
240
241These methods are not intended for end users
fa0f5b28
S
242
243- `_chooseWorker` => `chooseWorker`
280c2a77 244- `_newWorker` => `createWorker`
fa0f5b28
S
245- `_execute` => `internalExecute`
246- `_chooseWorker` => `chooseWorker`
247- `_checkAlive` => `checkAlive`
248- `_run` => `run`
249- `_runAsync` => `runAsync`
250
90ee1b18 251## [1.1.0] - 2020-05-21
0312f71a
APA
252
253### Added
254
255- ThreadWorker support async functions as option
cf9aa6c3 256- Various external library patches
0312f71a 257
90ee1b18 258## [1.0.0] - 2020-01-24
522eea03 259
260### Added
261
262- FixedThreadPool implementation
263- DynamicThreadPool implementation
0312f71a 264- WorkerThread implementation to improve developer experience