@@ -12,10 +12,7 @@ use std::pin::Pin;
1212use std:: sync:: { Arc , Mutex , Weak } ;
1313use std:: task:: { self , Poll } ;
1414
15- #[ cfg( not( feature = "runtime" ) ) ]
1615use std:: time:: { Duration , Instant } ;
17- #[ cfg( feature = "runtime" ) ]
18- use tokio:: time:: { Duration , Instant , Interval } ;
1916
2017use futures_channel:: oneshot;
2118use tracing:: { debug, trace} ;
@@ -97,9 +94,7 @@ struct PoolInner<T, K: Eq + Hash> {
9794 waiters : HashMap < K , VecDeque < oneshot:: Sender < T > > > ,
9895 // A oneshot channel is used to allow the interval to be notified when
9996 // the Pool completely drops. That way, the interval can cancel immediately.
100- #[ cfg( feature = "runtime" ) ]
10197 idle_interval_ref : Option < oneshot:: Sender < Infallible > > ,
102- #[ cfg( feature = "runtime" ) ]
10398 exec : Exec ,
10499 timeout : Option < Duration > ,
105100}
@@ -130,11 +125,9 @@ impl<T, K: Key> Pool<T, K> {
130125 Some ( Arc :: new ( Mutex :: new ( PoolInner {
131126 connecting : HashSet :: new ( ) ,
132127 idle : HashMap :: new ( ) ,
133- #[ cfg( feature = "runtime" ) ]
134128 idle_interval_ref : None ,
135129 max_idle_per_host : config. max_idle_per_host ,
136130 waiters : HashMap :: new ( ) ,
137- #[ cfg( feature = "runtime" ) ]
138131 exec,
139132 timeout : config. idle_timeout ,
140133 } ) ) )
@@ -152,7 +145,6 @@ impl<T, K: Key> Pool<T, K> {
152145 #[ cfg( test) ]
153146 pub ( super ) fn no_timer ( & self ) {
154147 // Prevent an actual interval from being created for this pool...
155- #[ cfg( feature = "runtime" ) ]
156148 {
157149 let mut inner = self . inner . as_ref ( ) . unwrap ( ) . lock ( ) . unwrap ( ) ;
158150 assert ! ( inner. idle_interval_ref. is_none( ) , "timer already spawned" ) ;
@@ -207,13 +199,11 @@ impl<T: Poolable, K: Key> Pool<T, K> {
207199 }
208200
209201 /* Used in client/tests.rs...
210- #[cfg(feature = "runtime")]
211202 #[cfg(test)]
212203 pub(super) fn h1_key(&self, s: &str) -> Key {
213204 Arc::new(s.to_string())
214205 }
215206
216- #[cfg(feature = "runtime")]
217207 #[cfg(test)]
218208 pub(super) fn idle_count(&self, key: &Key) -> usize {
219209 self
@@ -403,10 +393,7 @@ impl<T: Poolable, K: Key> PoolInner<T, K> {
403393 } ) ;
404394 }
405395
406- #[ cfg( feature = "runtime" ) ]
407- {
408- self . spawn_idle_interval ( __pool_ref) ;
409- }
396+ self . spawn_idle_interval ( __pool_ref) ;
410397 }
411398 None => trace ! ( "put; found waiter for {:?}" , key) ,
412399 }
@@ -423,8 +410,9 @@ impl<T: Poolable, K: Key> PoolInner<T, K> {
423410 self . waiters . remove ( key) ;
424411 }
425412
426- #[ cfg( feature = "runtime" ) ]
427- fn spawn_idle_interval ( & mut self , pool_ref : & Arc < Mutex < PoolInner < T , K > > > ) {
413+ fn spawn_idle_interval ( & mut self , _pool_ref : & Arc < Mutex < PoolInner < T , K > > > ) {
414+ // TODO
415+ /*
428416 let (dur, rx) = {
429417 if self.idle_interval_ref.is_some() {
430418 return;
@@ -446,6 +434,7 @@ impl<T: Poolable, K: Key> PoolInner<T, K> {
446434 };
447435
448436 self.exec.execute(interval);
437+ */
449438 }
450439}
451440
@@ -466,7 +455,6 @@ impl<T, K: Eq + Hash> PoolInner<T, K> {
466455 }
467456}
468457
469- #[ cfg( feature = "runtime" ) ]
470458impl < T : Poolable , K : Key > PoolInner < T , K > {
471459 /// This should *only* be called by the IdleTask
472460 fn clear_expired ( & mut self ) {
@@ -766,7 +754,7 @@ impl Expiration {
766754 }
767755}
768756
769- # [ cfg ( feature = "runtime" ) ]
757+ /*
770758pin_project_lite::pin_project! {
771759 struct IdleTask<T, K: Key> {
772760 #[pin]
@@ -780,7 +768,6 @@ pin_project_lite::pin_project! {
780768 }
781769}
782770
783- #[ cfg( feature = "runtime" ) ]
784771impl<T: Poolable + 'static, K: Key> Future for IdleTask<T, K> {
785772 type Output = ();
786773
@@ -809,6 +796,7 @@ impl<T: Poolable + 'static, K: Key> Future for IdleTask<T, K> {
809796 }
810797 }
811798}
799+ */
812800
813801impl < T > WeakOpt < T > {
814802 fn none ( ) -> Self {
@@ -932,7 +920,6 @@ mod tests {
932920 assert ! ( is_not_ready) ;
933921 }
934922
935- #[ cfg( feature = "runtime" ) ]
936923 #[ tokio:: test]
937924 async fn test_pool_checkout_removes_expired ( ) {
938925 let pool = pool_no_timer ( ) ;
@@ -971,7 +958,6 @@ mod tests {
971958 ) ;
972959 }
973960
974- #[ cfg( feature = "runtime" ) ]
975961 #[ tokio:: test]
976962 async fn test_pool_timer_removes_expired ( ) {
977963 tokio:: time:: pause ( ) ;
0 commit comments