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