Skip to content

Commit

Permalink
Merge pull request #1433 from isucon/recreate-transport-on-agent
Browse files Browse the repository at this point in the history
HTTP2 の Connection close 的なあれこれ対応パッチ
  • Loading branch information
buchy authored Aug 21, 2021
2 parents 6e919dc + 778b39c commit b254ddd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bench/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/francoispqt/gojay v1.2.13
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0
github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22
github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035
github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8
github.com/isucon/isucon11-qualify/bench/random v0.0.0-00010101000000-000000000000
github.com/labstack/echo/v4 v4.5.0
Expand Down
2 changes: 2 additions & 0 deletions bench/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22 h1:8LGGYd5yECQgJAH+OF0qgEBiLzm4mE4i6ktvFeq7u/E=
github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22/go.mod h1:B9L4o5rIoL2dKdHHVOFih3sZN1EfUFPtteVcSR5z1xw=
github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035 h1:6JhNwsSGVZa/Z1TphnHxeWC/4KZwguI0SInxNkLqPT0=
github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035/go.mod h1:B9L4o5rIoL2dKdHHVOFih3sZN1EfUFPtteVcSR5z1xw=
github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8 h1:3EP6xzY6pG71UdUBTWI3vjqQz/57fWrYnTANB7R4rX4=
github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8/go.mod h1:4hdJ/uFyj4jMNPfKq8KkrsrPyw5nV7B/5JRcAu1sgQM=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
Expand Down
10 changes: 10 additions & 0 deletions bench/scenario/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ func (s *Scenario) WithInitializeTimeout(t time.Duration) *Scenario {
return s
}

func (s *Scenario) separatedTransport() agent.AgentOption {
return func(a *agent.Agent) error {
transport := agent.DefaultTransport.Clone()
transport.MaxIdleConnsPerHost = 100
a.HttpClient.Transport = transport
return nil
}
}

func (s *Scenario) NewAgent(opts ...agent.AgentOption) (*agent.Agent, error) {
opts = append([]agent.AgentOption{s.separatedTransport()}, opts...)
opts = append(opts, agent.WithBaseURL(s.BaseURL), agent.WithUserAgent(useragent.UserAgent()))
return agent.NewAgent(opts...)
}
Expand Down

0 comments on commit b254ddd

Please sign in to comment.