fix: ensure not more than one task is executed on a worker with tasks
[poolifier.git] / CHANGELOG.md
... / ...
CommitLineData
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.1.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8## [Unreleased]
9
10## [2.4.5] - 2023-04-09
11
12### Added
13
14- Use monotonic high resolution timer for worker tasks run time.
15- Add worker tasks median run time to statistics.
16- Add worker tasks queue (experimental).
17
18## [2.4.4] - 2023-04-07
19
20### Added
21
22- Add `PoolEvents` enumeration and `PoolEvent` type.
23
24### Fixed
25
26- Destroy worker only on alive check.
27
28## [2.4.3] - 2023-04-07
29
30### Fixed
31
32- Fix typedoc generation with inheritance.
33
34## [2.4.2] - 2023-04-06
35
36### Added
37
38- Add `full` event to dynamic pool.
39- Keep worker choice strategy in memory for conditional reuse.
40
41### Fixed
42
43- Fix possible negative worker key at worker removal in worker choice strategies.
44
45## [2.4.1] - 2023-04-05
46
47### Changed
48
49- Optimize worker choice strategy for dynamic pool.
50
51### Fixed
52
53- Ensure dynamic pool does not alter worker choice strategy expected behavior.
54
55## [2.4.0] - 2023-04-04
56
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
77## [2.4.0-3] - 2023-04-04
78
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
98## [2.4.0-2] - 2023-04-03
99
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
118## [2.4.0-1] - 2023-04-03
119
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
137## [2.4.0-0] - 2023-04-03
138
139### Added
140
141- Add `LESS_BUSY` worker choice strategy.
142
143### Changed
144
145- Optimize worker storage in pool.
146- Optimize worker alive status check.
147- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
148- Optimize `LESS_USED` worker choice strategy.
149
150### Fixed
151
152- Ensure trimmable characters are checked at pool initialization.
153- Fix message id integer overflow.
154- Fix pool worker removal in worker choice strategy internals.
155
156## [2.3.10] - 2023-03-18
157
158### Fixed
159
160- Fix `exports` syntax for ESM and CommonJS.
161
162### Changed
163
164- Permit SemVer pre-release publication.
165
166## [2.3.10-2] - 2023-03-18
167
168### Fixed
169
170- Fix `exports` syntax for ESM and CommonJS.
171
172## [2.3.10-1] - 2023-03-18
173
174### Changed
175
176- Permit SemVer pre-release publication.
177
178## [2.3.10-0] - 2023-03-18
179
180### Fixed
181
182- Fix `exports` syntax for ESM and CommonJS.
183
184## [2.3.9] - 2023-03-18
185
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
194## [2.3.8] - 2023-03-18
195
196### Changed
197
198- Switch internal benchmarking code to benny.
199- Switch to TypeScript 5.x.x.
200- Switch rollup bundler plugins to core ones.
201- Switch to TSDoc syntax.
202- Enforce conventional commits.
203
204### Fixed
205
206- Fix random integer generator.
207- Fix worker choice strategy pool type identification at initialization.
208
209## [2.3.7] - 2022-10-23
210
211### Changed
212
213- Switch to open collective FOSS project funding platform.
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.
221
222## [2.3.6] - 2022-10-22
223
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
234## [2.3.5] - 2022-10-21
235
236### Changed
237
238- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
239- Optimize tasks usage lookup implementation.
240
241### Fixed
242
243- Fix missed pool event emitter type export.
244- Fix typedoc documentation generation.
245
246## [2.3.4] - 2022-10-17
247
248### Added
249
250- Fully automate release process with release-it.
251
252### Changed
253
254- Optimize fair share task scheduling algorithm implementation.
255- Update benchmarks versus external pools results with latest version.
256
257## [2.3.3] - 2022-10-15
258
259### Added
260
261- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
262
263## [2.3.2] - 2022-10-14
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
273## [2.3.1] - 2022-10-13
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
281## [2.2.2] - 2022-10-09
282
283### Fixed
284
285- Fixed `README.md` file.
286
287## [2.2.1] - 2022-10-08
288
289### Added
290
291- Dynamic worker choice strategy change at runtime.
292
293## [2.2.0] - 2022-01-05
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
299## [2.1.0] - 2021-08-29
300
301### Added
302
303- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
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`.
310- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
311
312## [2.0.2] - 2021-05-12
313
314### Bug fixes
315
316- Fix `busy` event emission on fixed pool type
317
318## [2.0.1] - 2021-03-16
319
320### Bug fixes
321
322- Check if pool options are properly set.
323- `busy` event is emitted on all pool types.
324
325## [2.0.0] - 2021-03-01
326
327### Bug fixes
328
329- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
330
331### Breaking Changes
332
333- `FullPool` event is now renamed to `busy`.
334- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
335 _Find more details on our JSDoc._
336
337- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
338
339- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
340
341### Pool options types declaration merge
342
343`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
344
345#### New `export` strategy
346
347```js
348// Before
349const DynamicThreadPool = require('poolifier/lib/dynamic')
350// After
351const { DynamicThreadPool } = require('poolifier/lib/dynamic')
352```
353
354But you should always prefer just using
355
356```js
357const { DynamicThreadPool } = require('poolifier')
358```
359
360#### New type definitions for input data and response
361
362For cluster worker and worker-thread pools, you can now only send and receive serializable data.
363_This is not a limitation by poolifier but NodeJS._
364
365#### Public property replacements
366
367`numWorkers` property is now `numberOfWorkers`
368
369#### Internal (protected) properties and methods renaming
370
371These properties are not intended for end users
372
373- `id` => `nextMessageId`
374
375These methods are not intended for end users
376
377- `_chooseWorker` => `chooseWorker`
378- `_newWorker` => `createWorker`
379- `_execute` => `internalExecute`
380- `_chooseWorker` => `chooseWorker`
381- `_checkAlive` => `checkAlive`
382- `_run` => `run`
383- `_runAsync` => `runAsync`
384
385## [1.1.0] - 2020-05-21
386
387### Added
388
389- ThreadWorker support async functions as option
390- Various external library patches
391
392## [1.0.0] - 2020-01-24
393
394### Added
395
396- FixedThreadPool implementation
397- DynamicThreadPool implementation
398- WorkerThread implementation to improve developer experience