Merge pull request #7615 from swordqiu/hotfix/qj-get-default-http-client-always-new-instance

fix: GetDefaultClient always return a new http client instance
This commit is contained in:
Zexi Li
2020-08-24 22:17:41 +08:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -215,7 +215,7 @@ func (b *EtcdBackend) shouldDeleteWatchedResource(ctx context.Context, keywordPl
clientsKey := fmt.Sprintf("/%s/%s", keywordPlural, EtcdInformerClientsKey)
pairs, err := b.client.List(ctx, clientsKey)
if err != nil {
log.Errorf("list clientsKey %s error: %v", err)
log.Errorf("list clientsKey %s error: %v", clientsKey, err)
return false
}
return len(pairs) == 0
+2 -2
View File
@@ -411,11 +411,11 @@ func GetAdaptiveTimeoutClient() *http.Client {
var defaultHttpClient *http.Client
func init() {
defaultHttpClient = GetClient(true, time.Second*15)
defaultHttpClient = GetDefaultClient()
}
func GetDefaultClient() *http.Client {
return defaultHttpClient
return GetClient(true, time.Second*15)
}
func Request(client *http.Client, ctx context.Context, method THttpMethod, urlStr string, header http.Header, body io.Reader, debug bool) (*http.Response, error) {