Fixes infinite loop (and consequentially spiked CPU usage) on ctx timeout

This commit is contained in:
Ben Davies 2017-06-22 13:27:36 +01:00 committed by Kenneth Shaw
parent 9282791225
commit 10a6f7bd20

6
sel.go
View File

@ -83,8 +83,14 @@ 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 {
select {
case <-ctxt.Done():
ch <- ctxt.Err()
return
default:
continue continue
} }
}
select { select {
default: default: