Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specify IdleConnTimeout for http2 connections too
Browse files Browse the repository at this point in the history
jsnjack committed Apr 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 70a3364 commit 6618950
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion roundtripper.go
Original file line number Diff line number Diff line change
@@ -141,7 +141,13 @@ func (rt *roundTripper) dialTLS(ctx context.Context, network, addr string) (net.
utlsConfig.ServerName = rt.serverNameOverwrite
}

t2 := http2.Transport{DialTLS: rt.dialTLSHTTP2, TLSClientConfig: utlsConfig, ConnectionFlow: rt.connectionFlow, HeaderPriority: rt.headerPriority}
t2 := http2.Transport{
DialTLS: rt.dialTLSHTTP2,
TLSClientConfig: utlsConfig,
ConnectionFlow: rt.connectionFlow,
HeaderPriority: rt.headerPriority,
IdleConnTimeout: rt.transportOptions.IdleConnTimeout,

This comment has been minimized.

Copy link
@bogdanfinn

bogdanfinn Apr 18, 2023

Owner

@jsnjack we should specify a defaultIdleConnTimeout if the user is not setting transportOptions what do you think?

The Go Default Transport is using 90 seconds:

IdleConnTimeout:       90 * [time](https://pkg.go.dev/time).[Second](https://pkg.go.dev/time#Second),

This comment has been minimized.

Copy link
@jsnjack

jsnjack Apr 19, 2023

Author Contributor

Yeah, totally makes sense!

}

if rt.transportOptions != nil {
t1 := t2.GetT1()

0 comments on commit 6618950

Please sign in to comment.