File tree Expand file tree Collapse file tree 3 files changed +9
-15
lines changed Expand file tree Collapse file tree 3 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -229,9 +229,7 @@ impl Pool {
229229            . connection_count 
230230            . store ( exchange. exist ,  atomic:: Ordering :: Relaxed ) ; 
231231        // we just enabled the creation of a new connection! 
232-         if  let  Some ( w)  = exchange. waiting . pop ( )  { 
233-             w. wake ( ) ; 
234-         } 
232+         exchange. waiting . wake ( ) ; 
235233    } 
236234
237235    /// Poll the pool for an available connection. 
Original file line number Diff line number Diff line change @@ -81,9 +81,7 @@ impl Recycler {
8181                . metrics 
8282                . connections_in_pool 
8383                . store ( exchange. available . len ( ) ,  Ordering :: Relaxed ) ; 
84-             if  let  Some ( w)  = exchange. waiting . pop ( )  { 
85-                 w. wake ( ) ; 
86-             } 
84+             exchange. waiting . wake ( ) ; 
8785        } 
8886    } 
8987} 
@@ -244,9 +242,7 @@ impl Future for Recycler {
244242                . connection_count 
245243                . store ( exchange. exist ,  Ordering :: Relaxed ) ; 
246244            for  _ in  0 ..self . discarded  { 
247-                 if  let  Some ( w)  = exchange. waiting . pop ( )  { 
248-                     w. wake ( ) ; 
249-                 } 
245+                 exchange. waiting . wake ( ) ; 
250246            } 
251247            drop ( exchange) ; 
252248            self . discarded  = 0 ; 
@@ -282,9 +278,7 @@ impl Future for Recycler {
282278        if  self . inner . closed . load ( Ordering :: Acquire )  { 
283279            // `DisconnectPool` might still wait to be woken up. 
284280            let  mut  exchange = self . inner . exchange . lock ( ) . unwrap ( ) ; 
285-             while  let  Some ( w)  = exchange. waiting . pop ( )  { 
286-                 w. wake ( ) ; 
287-             } 
281+             while  exchange. waiting . wake ( )  { } 
288282            // we're about to exit, so there better be no outstanding connections 
289283            assert_eq ! ( exchange. exist,  0 ) ; 
290284            assert_eq ! ( exchange. available. len( ) ,  0 ) ; 
Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ impl Waitlist {
4848        !occupied
4949    } 
5050
51-     pub ( crate )  fn  pop ( & mut  self )  -> Option < Waker >  { 
51+     /// Returns `true` if anyone was awaken 
52+ pub ( crate )  fn  wake ( & mut  self )  -> bool  { 
5253        match  self . queue . pop ( )  { 
5354            Some ( ( qw,  _) )  => { 
5455                self . metrics 
5556                    . active_wait_requests 
5657                    . fetch_sub ( 1 ,  atomic:: Ordering :: Relaxed ) ; 
57-                 Some ( qw. waker ) 
58+                 qw. waker . wake ( ) ; 
59+                 true 
5860            } 
59-             None  => None , 
61+             None  => false , 
6062        } 
6163    } 
6264
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments