Skip to content

Commit

Permalink
ai/live: Disable golang client keepalives. (#3343)
Browse files Browse the repository at this point in the history
This prevents dangling connections after each trickle segment.
  • Loading branch information
j0sh authored Jan 8, 2025
1 parent 8d6e7ec commit e9ba699
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions trickle/trickle_publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (c *TricklePublisher) preconnect() (*pendingPost, error) {
go func() {
// Createa new client to prevent connection reuse
client := http.Client{Transport: &http.Transport{
DisableKeepAlives: true,
// ignore orch certs for now
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}}
Expand Down Expand Up @@ -126,6 +127,7 @@ func (c *TricklePublisher) Close() error {
return err
}
resp, err := (&http.Client{Transport: &http.Transport{
DisableKeepAlives: true,
// ignore orch certs for now
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}}).Do(req)
Expand Down Expand Up @@ -260,6 +262,7 @@ func (p *pendingPost) Close() error {
return err
}
resp, err := (&http.Client{Transport: &http.Transport{
DisableKeepAlives: true,
// ignore orch certs for now
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}}).Do(req)
Expand Down
3 changes: 2 additions & 1 deletion trickle/trickle_subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ func (c *TrickleSubscriber) connect(ctx context.Context) (*http.Response, error)

// Execute the GET request
resp, err := (&http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DisableKeepAlives: true,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}}).Do(req)
if err != nil {
return nil, fmt.Errorf("failed to complete GET for next segment: %w", err)
Expand Down

0 comments on commit e9ba699

Please sign in to comment.