From 3e4c1937a1b68322eebe2c6c88875547b0be64a7 Mon Sep 17 00:00:00 2001 From: king41409 Date: Fri, 12 Apr 2019 11:22:02 +0800 Subject: [PATCH] add SetMaxConns sets the maxIdleConns, maxIdleConnsPerHost. --- oss/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oss/client.go b/oss/client.go index ff370f6d..0988bc9b 100644 --- a/oss/client.go +++ b/oss/client.go @@ -803,3 +803,11 @@ func (client Client) do(method, bucketName string, params map[string]interface{} return client.Conn.Do(method, bucketName, "", params, headers, data, 0, nil) } + +// SetMaxConns sets the maxIdleConns, maxIdleConnsPerHost. +func SetMaxConns(maxIdleConns, maxIdleConnsPerHost int) ClientOption { + return func(client *Client) { + client.Config.HTTPMaxConns.MaxIdleConns = maxIdleConns + client.Config.HTTPMaxConns.MaxIdleConnsPerHost = maxIdleConnsPerHost + } +}