File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -617,7 +617,12 @@ func TestStreamableClientConnSSEGoroutineLeak(t *testing.T) {
617
617
}
618
618
619
619
// Start the handleSSE goroutine manually
620
- go conn .handleSSE (resp )
620
+ var wg sync.WaitGroup
621
+ wg .Add (1 )
622
+ go func () {
623
+ conn .handleSSE (resp )
624
+ wg .Done ()
625
+ }()
621
626
622
627
// Wait until incoming channel is filled
623
628
deadlineCtx , cancelFunc := context .WithTimeout (context .Background (), 100 * time .Millisecond )
@@ -633,7 +638,7 @@ func TestStreamableClientConnSSEGoroutineLeak(t *testing.T) {
633
638
634
639
// Now simulate calling Close() and blocking the goroutine
635
640
close (conn .done )
636
- time . Sleep ( 50 * time . Millisecond ) // Allow goroutine to exit
641
+ wg . Wait ()
637
642
638
643
// Check if "scanEvents" goroutine is still running
639
644
leakKey := "scanEvents"
You can’t perform that action at this time.
0 commit comments