Commit ddd2a37
committed
fix: change _handle_reconnection to return bool and fix infinite recursion
_handle_reconnection previously returned None, making it impossible for
callers to distinguish between a successful response delivery and
exhausted retries. This changes the return type to bool (True on success,
False when max attempts exceeded) and fixes two issues:
- The attempt counter at line 426 was reset to 0 on each reconnection,
causing infinite recursion when streams kept ending without delivering
a response. Now increments attempt on each recursion.
- All recursive calls now use `return await` so the result propagates
back to the original caller.
MAX_RECONNECTION_ATTEMPTS increased from 2 to 5 to accommodate
legitimate multi-reconnection patterns where the server intentionally
closes streams between checkpoints.
Github-Issue: #14011 parent 0fe16dd commit ddd2a37
2 files changed
+52
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
382 | 387 | | |
383 | | - | |
| 388 | + | |
384 | 389 | | |
385 | | - | |
| 390 | + | |
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
| |||
419 | 424 | | |
420 | 425 | | |
421 | 426 | | |
422 | | - | |
| 427 | + | |
423 | 428 | | |
424 | | - | |
| 429 | + | |
425 | 430 | | |
426 | | - | |
| 431 | + | |
427 | 432 | | |
428 | 433 | | |
429 | 434 | | |
430 | | - | |
| 435 | + | |
431 | 436 | | |
432 | 437 | | |
433 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
2247 | 2254 | | |
2248 | 2255 | | |
2249 | 2256 | | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
0 commit comments