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