Commit cb61477
refactor: extract
The same guarded-callback pattern (`if cb is not None: try: cb(...); except
Exception: pass`, with identical "best-effort; draining must not stop"
comment) was duplicated three times across `_read_agent_stream` and
`_pump_stream`. Consolidate into a single `_call_safely` helper defined
next to the callback type aliases. Behavior unchanged — the helper
preserves the None guard, suppresses all exceptions, and only fires the
callback once with the provided arguments.
Co-authored-by: Ralphify <noreply@ralphify.co>_call_safely helper for best-effort observer callbacks1 parent eb2f4b9 commit cb61477
1 file changed
Lines changed: 19 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
51 | 67 | | |
52 | 68 | | |
53 | 69 | | |
| |||
360 | 376 | | |
361 | 377 | | |
362 | 378 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
| 379 | + | |
369 | 380 | | |
370 | 381 | | |
371 | 382 | | |
| |||
378 | 389 | | |
379 | 390 | | |
380 | 391 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| |||
502 | 508 | | |
503 | 509 | | |
504 | 510 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
| 511 | + | |
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
| |||
0 commit comments