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