File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ type Client interface {
7979	Do (context.Context , * http.Request ) (* http.Response , []byte , error )
8080}
8181
82+ type  closeIdler  interface  {
83+ 	CloseIdleConnections ()
84+ }
85+ 
8286// NewClient returns a new Client. 
8387// 
8488// It is safe to use the returned Client from multiple goroutines. 
@@ -99,6 +103,10 @@ func NewClient(cfg Config) (Client, error) {
99103	}, nil 
100104}
101105
106+ func  ClientCloseIdler (cl  Client ) {
107+ 	cl .(closeIdler ).CloseIdleConnections ()
108+ }
109+ 
102110type  httpClient  struct  {
103111	endpoint  * url.URL 
104112	client    http.Client 
@@ -118,6 +126,10 @@ func (c *httpClient) URL(ep string, args map[string]string) *url.URL {
118126	return  & u 
119127}
120128
129+ func  (c  * httpClient ) CloseIdleConnections () {
130+ 	c .client .CloseIdleConnections ()
131+ }
132+ 
121133func  (c  * httpClient ) Do (ctx  context.Context , req  * http.Request ) (* http.Response , []byte , error ) {
122134	if  ctx  !=  nil  {
123135		req  =  req .WithContext (ctx )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments