Skip to content

Commit

Permalink
identity package default tweaks (#811)
Browse files Browse the repository at this point in the history
- limits on HTTP idle connections. mostly impacts did:web and HTTPS
handle resolution, which can otherwise result in huge numbers of sockets
hanging around (one per custom domain) when operating at scale. values
chosen should not have too bad an impact on PLC usage, though we might
want to split out separate PLC and non-PLC HTTP clients at some point
- drop some timeouts
  • Loading branch information
bnewbold authored Nov 15, 2024
2 parents 785ad18 + d88346a commit 0fc4c7e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions atproto/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ func DefaultDirectory() Directory {
base := BaseDirectory{
PLCURL: DefaultPLCURL,
HTTPClient: http.Client{
Timeout: time.Second * 15,
Timeout: time.Second * 10,
Transport: &http.Transport{
// would want this around 100ms for services doing lots of handle resolution. Impacts PLC connections as well, but not too bad.
IdleConnTimeout: time.Millisecond * 1000,
MaxIdleConns: 100,
},
},
Resolver: net.Resolver{
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{Timeout: time.Second * 5}
d := net.Dialer{Timeout: time.Second * 3}
return d.DialContext(ctx, network, address)
},
},
Expand Down

0 comments on commit 0fc4c7e

Please sign in to comment.