Don't allow the lazyLoadedHTTPClient mutex to wrap Do()
We only need a mutex around accessing `l.httpClient`, but never around the actual HTTP request.
This commit is contained in:
parent
be22cabe0b
commit
a723813064
1 changed files with 3 additions and 3 deletions
|
|
@ -151,14 +151,14 @@ func (l *lazyLoadedHTTPClient) Do(req *http.Request) (*http.Response, error) {
|
|||
l.httpClientMu.RUnlock()
|
||||
|
||||
if httpClient == nil {
|
||||
l.httpClientMu.Lock()
|
||||
defer l.httpClientMu.Unlock()
|
||||
|
||||
var err error
|
||||
l.httpClientMu.Lock()
|
||||
l.httpClient, err = l.factory.HttpClient()
|
||||
l.httpClientMu.Unlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return l.httpClient.Do(req)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue