refactor: rename a worker choice strategy
[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.0.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8 ## [Unreleased]
9
10 ### Changed
11
12 - Optimize worker storage in pool.
13 - Optimize worker alive status check.
14 - Rename worker choice strategy `LESS_RECENTLY_USED to `LESS_USED` .
15 - Optimize `LESS_USED` worker choice strategy.
16
17 ### Fixed
18
19 - Ensure trimmable characters are checked at pool initialization.
20 - Fix message id integer overflow.
21
22 ## [2.3.10] - 2023-03-18
23
24 ### Fixed
25
26 - Fix `exports` syntax for ESM and CommonJS.
27
28 ### Changed
29
30 - Permit SemVer pre-release publication.
31
32 ## [2.3.10-2] - 2023-03-18
33
34 ### Fixed
35
36 - Fix `exports` syntax for ESM and CommonJS.
37
38 ## [2.3.10-1] - 2023-03-18
39
40 ### Changed
41
42 - Permit SemVer pre-release publication.
43
44 ## [2.3.10-0] - 2023-03-18
45
46 ### Fixed
47
48 - Fix `exports` syntax for ESM and CommonJS.
49
50 ## [2.3.9] - 2023-03-18
51
52 ### Changed
53
54 - Introduce ESM module support along with CommonJS one.
55
56 ### Fixed
57
58 - Fix brown paper bag bug referencing the same object literal.
59
60 ## [2.3.8] - 2023-03-18
61
62 ### Changed
63
64 - Switch internal benchmarking code to benny.
65 - Switch to TypeScript 5.x.x.
66 - Switch rollup bundler plugins to core ones.
67 - Switch to TSDoc syntax.
68 - Enforce conventional commits.
69
70 ### Fixed
71
72 - Fix random integer generator.
73 - Fix worker choice strategy pool type identification at initialization.
74
75 ## [2.3.7] - 2022-10-23
76
77 ### Changed
78
79 - Switch to open collective FOSS project funding platform.
80 - Switch to ts-standard linter configuration on TypeScript code.
81
82 ### Fixed
83
84 - Fixed missing async on pool execute method.
85 - Fixed typing in TypeScript example.
86 - Fixed types in unit tests.
87
88 ## [2.3.6] - 2022-10-22
89
90 ### Changed
91
92 - Cleanup pool attributes and methods.
93 - Refine error types thrown.
94
95 ### Fixed
96
97 - Fix continuous integration build on windows.
98 - Fix code coverage reporting by using c8 instead of nyc.
99
100 ## [2.3.5] - 2022-10-21
101
102 ### Changed
103
104 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
105 - Optimize tasks usage lookup implementation.
106
107 ### Fixed
108
109 - Fix missed pool event emitter type export.
110 - Fix typedoc documentation generation.
111
112 ## [2.3.4] - 2022-10-17
113
114 ### Added
115
116 - Fully automate release process with release-it.
117
118 ### Changed
119
120 - Optimize fair share task scheduling algorithm implementation.
121 - Update benchmarks versus external pools results with latest version.
122
123 ## [2.3.3] - 2022-10-15
124
125 ### Added
126
127 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
128
129 ## [2.3.2] - 2022-10-14
130
131 ### Changed
132
133 - Optimize fair share worker selection strategy implementation.
134
135 ### Fixed
136
137 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
138
139 ## [2.3.1] - 2022-10-13
140
141 ### Added
142
143 - Pool worker choice strategies:
144 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
145 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
146
147 ## [2.2.2] - 2022-10-09
148
149 ### Fixed
150
151 - Fixed `README.md` file.
152
153 ## [2.2.1] - 2022-10-08
154
155 ### Added
156
157 - Dynamic worker choice strategy change at runtime.
158
159 ## [2.2.0] - 2022-01-05
160
161 ### Breaking Changes
162
163 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
164
165 ## [2.1.0] - 2021-08-29
166
167 ### Added
168
169 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
170
171 ### Breaking Changes
172
173 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
174 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
175 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
176 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
177
178 ## [2.0.2] - 2021-05-12
179
180 ### Bug fixes
181
182 - Fix `busy` event emission on fixed pool type
183
184 ## [2.0.1] - 2021-03-16
185
186 ### Bug fixes
187
188 - Check if pool options are properly set.
189 - `busy` event is emitted on all pool types.
190
191 ## [2.0.0] - 2021-03-01
192
193 ### Bug fixes
194
195 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
196
197 ### Breaking Changes
198
199 - `FullPool` event is now renamed to `busy`.
200 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
201 _Find more details on our JSDoc._
202
203 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
204
205 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
206
207 ### Pool options types declaration merge
208
209 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
210
211 #### New `export` strategy
212
213 ```js
214 // Before
215 const DynamicThreadPool = require('poolifier/lib/dynamic')
216 // After
217 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
218 ```
219
220 But you should always prefer just using
221
222 ```js
223 const { DynamicThreadPool } = require('poolifier')
224 ```
225
226 #### New type definitions for input data and response
227
228 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
229 _This is not a limitation by poolifier but NodeJS._
230
231 #### Public property replacements
232
233 `numWorkers` property is now `numberOfWorkers`
234
235 #### Internal (protected) properties and methods renaming
236
237 These properties are not intended for end users
238
239 - `id` => `nextMessageId`
240
241 These methods are not intended for end users
242
243 - `_chooseWorker` => `chooseWorker`
244 - `_newWorker` => `createWorker`
245 - `_execute` => `internalExecute`
246 - `_chooseWorker` => `chooseWorker`
247 - `_checkAlive` => `checkAlive`
248 - `_run` => `run`
249 - `_runAsync` => `runAsync`
250
251 ## [1.1.0] - 2020-05-21
252
253 ### Added
254
255 - ThreadWorker support async functions as option
256 - Various external library patches
257
258 ## [1.0.0] - 2020-01-24
259
260 ### Added
261
262 - FixedThreadPool implementation
263 - DynamicThreadPool implementation
264 - WorkerThread implementation to improve developer experience