@@ -10,7 +10,7 @@ use std::str::FromStr;
10
10
use std:: sync:: atomic:: { AtomicBool , AtomicI16 , AtomicU8 , Ordering } ;
11
11
use std:: sync:: Arc ;
12
12
use std:: time:: { Duration , Instant , SystemTime , UNIX_EPOCH } ;
13
- use std:: { fmt, thread} ;
13
+ use std:: { fmt, thread, env } ;
14
14
15
15
use log:: { max_level, Level } ;
16
16
@@ -626,14 +626,19 @@ impl Connection {
626
626
} else {
627
627
None
628
628
} ;
629
+ // get pool size from envvar
630
+ let pool_max_idle_per_host = match env:: var ( "REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST" ) {
631
+ Ok ( val) => val. parse :: < usize > ( ) . unwrap_or ( 20 ) ,
632
+ Err ( _) => 20 ,
633
+ } ;
629
634
630
635
let mut cb = Client :: builder ( )
631
636
. timeout ( timeout)
632
637
. connect_timeout ( connect_timeout)
633
638
. redirect ( Policy :: none ( ) ) ;
634
639
. use_rustls_tls ( )
635
640
. tcp_keepalive ( Some ( Duration :: from_secs ( 5 * 60 ) ) )
636
- . pool_max_idle_per_host ( 20 ) ;
641
+ . pool_max_idle_per_host ( pool_max_idle_per_host ) ;
637
642
638
643
if config. skip_verify {
639
644
cb = cb. danger_accept_invalid_certs ( true ) ;
@@ -642,11 +647,7 @@ impl Connection {
642
647
if !proxy. is_empty ( ) {
643
648
cb = cb. proxy ( reqwest:: Proxy :: all ( proxy) . map_err ( |e| einval ! ( e) ) ?)
644
649
}
645
- debug ! (
646
- "{} building connection with proxy: {}" ,
647
- std:: thread:: current( ) . name( ) . unwrap_or_default( ) ,
648
- proxy
649
- ) ;
650
+
650
651
cb. build ( ) . map_err ( |e| einval ! ( e) )
651
652
}
652
653
0 commit comments