Fix potential goroutine leak in syncs/watchdog.go

Depending on how the preemption will occur, in some scenarios sendc
would have blocked indefinitely even after cancelling the context.

Fixes #10315

Signed-off-by: Uri Gorelik <uri.gore@gmail.com>
pull/10322/head
Uri Gorelik 7 months ago committed by Denton Gentry
parent e7cad78b00
commit b88929edf8

@ -29,7 +29,10 @@ func Watch(ctx context.Context, mu sync.Locker, tick, max time.Duration) chan ti
// Drop values written after c is closed. // Drop values written after c is closed.
return return
} }
c <- d select {
case c <- d:
case <-ctx.Done():
}
} }
closec := func() { closec := func() {
closemu.Lock() closemu.Lock()

Loading…
Cancel
Save