Commit 6fef647
Fix notifier Ping called with cancelled context
In waitOnce, the inner context is cancelled by drainErrChan to interrupt
WaitForNotification, but the subsequent Ping call was using that same
cancelled context, meaning it would always fail with context.Canceled.
Save a reference to the parent (still-live) context before creating the
inner cancellable context, and use it for the Ping call.
Also adds a testPingInterval field to avoid the 5s wait in tests, and
extends ListenerMock with a pingFunc for testing Ping behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent c449b62 commit 6fef647
2 files changed
Lines changed: 66 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
348 | 356 | | |
349 | 357 | | |
350 | 358 | | |
| |||
382 | 390 | | |
383 | 391 | | |
384 | 392 | | |
385 | | - | |
| 393 | + | |
| 394 | + | |
386 | 395 | | |
387 | 396 | | |
388 | 397 | | |
| |||
397 | 406 | | |
398 | 407 | | |
399 | 408 | | |
400 | | - | |
401 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
402 | 413 | | |
403 | 414 | | |
404 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
534 | 579 | | |
535 | 580 | | |
536 | 581 | | |
| |||
584 | 629 | | |
585 | 630 | | |
586 | 631 | | |
| 632 | + | |
587 | 633 | | |
588 | 634 | | |
589 | 635 | | |
| |||
593 | 639 | | |
594 | 640 | | |
595 | 641 | | |
| 642 | + | |
596 | 643 | | |
597 | 644 | | |
598 | 645 | | |
| |||
605 | 652 | | |
606 | 653 | | |
607 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
608 | 659 | | |
609 | 660 | | |
610 | 661 | | |
| |||
0 commit comments