Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fa36dd8

Browse files
committedJun 4, 2024·
http2: dial retry should respect to request timeout
1 parent f91b074 commit fa36dd8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎http2/client_conn_pool.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,13 @@ func (p *clientConnPool) getClientConn(req *http.Request, addr string, dialOnMis
9494
traceGetConn(req, addr)
9595
call := p.getStartDialLocked(req.Context(), addr)
9696
p.mu.Unlock()
97-
<-call.done
98-
if shouldRetryDial(call, req) {
99-
continue
97+
select {
98+
case <-call.done:
99+
if shouldRetryDial(call, req) {
100+
continue
101+
}
102+
case <-req.Context().Done():
103+
return nil, req.Context().Err()
100104
}
101105
cc, err := call.res, call.err
102106
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.