Skip to content

Commit cb6db95

Browse files
authored
Merge pull request cli#4403 from cli/cs-concurrent-requests
Don't allow the lazyLoadedHTTPClient mutex to wrap `Do()`
2 parents 77e8b16 + a723813 commit cb6db95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cmd/root/root.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ func (l *lazyLoadedHTTPClient) Do(req *http.Request) (*http.Response, error) {
151151
l.httpClientMu.RUnlock()
152152

153153
if httpClient == nil {
154-
l.httpClientMu.Lock()
155-
defer l.httpClientMu.Unlock()
156-
157154
var err error
155+
l.httpClientMu.Lock()
158156
l.httpClient, err = l.factory.HttpClient()
157+
l.httpClientMu.Unlock()
159158
if err != nil {
160159
return nil, err
161160
}
162161
}
162+
163163
return l.httpClient.Do(req)
164164
}

0 commit comments

Comments
 (0)