Commit dbf2bf3
committed
improvements [claude]
1. Weight Validation: Added validation to ensure all provider weights are not zero (prevents silent failures)
2. Fixed Error Retesting Logic: Moved error retesting to occur AFTER weight-based selection, preventing it from skewing the intended weight distribution
3. Configuration Documentation: Added comprehensive comments in the config file explaining:
- Weight ranges (0.0 to 1.0)
- That weights are relative and don't need to sum to 1.0
- Examples of weight distribution calculations
- Requirement that at least one provider must have weight > 0.0
4. Inline Code Documentation: Added detailed doc comments for all weight-related methods explaining:
- The purpose and behavior of each selection strategy
- How weights are normalized internally
- Fallback mechanisms when weights are invalid
5. Metrics Decision: Per your feedback, avoided adding debug/trace logging to prevent performance and storage overhead
🎯 Key Benefits of These Changes:
- More Predictable Distribution: Error retesting now only slightly perturbs weight distribution instead of completely overriding it
- Better Error Prevention: Validation catches configuration mistakes early
- Improved Maintainability: Clear documentation helps future developers understand the system
- Production Ready: The implementation is now more robust with proper validation and error handling
The weighted load-balancing feature is now more reliable, better documented, and will behave more predictably in production environments.1 parent 59747b2 commit dbf2bf3
File tree
3 files changed
+55
-19
lines changed- chain/ethereum/src
- node
- resources/tests
- src
3 files changed
+55
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
205 | 212 | | |
206 | 213 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
220 | 219 | | |
221 | 220 | | |
222 | | - | |
| 221 | + | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
228 | 229 | | |
| 230 | + | |
| 231 | + | |
229 | 232 | | |
230 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
| |||
240 | 247 | | |
241 | 248 | | |
242 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
243 | 257 | | |
244 | 258 | | |
245 | 259 | | |
| |||
261 | 275 | | |
262 | 276 | | |
263 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
264 | 283 | | |
265 | 284 | | |
266 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
552 | 562 | | |
553 | 563 | | |
554 | 564 | | |
| |||
0 commit comments