Fixes infinite loop (and consequentially spiked CPU usage) on ctx timeout
This commit is contained in:
parent
9282791225
commit
10a6f7bd20
8
sel.go
8
sel.go
@ -83,7 +83,13 @@ func (s *Selector) run(ctxt context.Context, h cdp.Handler) chan error {
|
|||||||
for {
|
for {
|
||||||
root, err := h.GetRoot(ctxt)
|
root, err := h.GetRoot(ctxt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
select {
|
||||||
|
case <-ctxt.Done():
|
||||||
|
ch <- ctxt.Err()
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user