avoid ctx.Done() goroutine leak in Selector.run
As spotted in #162 by a contributor, if the context is done before the Selector.run caller has received from the channel, the spawned goroutine may leak if blocked on a send.
This commit is contained in:
parent
811d6d54d3
commit
26c9acb5b1
2
sel.go
2
sel.go
|
@ -80,7 +80,7 @@ func (s *Selector) Do(ctxt context.Context, h cdp.Executor) error {
|
|||
// are invalidated prior to finishing the selector's by, wait, check, and after
|
||||
// funcs.
|
||||
func (s *Selector) run(ctxt context.Context, h *TargetHandler) chan error {
|
||||
ch := make(chan error)
|
||||
ch := make(chan error, 1)
|
||||
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
|
Loading…
Reference in New Issue
Block a user