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