Fixes infinite loop (and consequentially spiked CPU usage) on ctx timeout
This commit is contained in:
		
							parent
							
								
									9282791225
								
							
						
					
					
						commit
						10a6f7bd20
					
				
							
								
								
									
										6
									
								
								sel.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								sel.go
									
									
									
									
									
								
							@ -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:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user