Skip to content

Commit

Permalink
HTTP pool 2.X
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Jan 8, 2025
1 parent c8c94f8 commit d933070
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.1
2.4.2-rc3
2 changes: 1 addition & 1 deletion cmd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package cmd

const (
// AppVersion is the current version of the app
AppVersion = "2.4.1"
AppVersion = "2.4.2-rc3"

// AppName is the name of the application to use in logging / places that require the artifact
AppName = "snowbridge"
Expand Down
9 changes: 7 additions & 2 deletions pkg/target/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -111,7 +112,8 @@ func newHTTPTarget(httpURL string, requestTimeout int, byteLimit int, contentTyp
if err1 != nil {
return nil, err1
}
transport := &http.Transport{}
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.MaxIdleConnsPerHost = transport.MaxIdleConns

tlsConfig, err2 := common.CreateTLSConfiguration(certFile, keyFile, caFile, skipVerifyTLS)
if err2 != nil {
Expand Down Expand Up @@ -249,7 +251,10 @@ func (ht *HTTPTarget) Write(messages []*models.Message) (*models.TargetWriteResu
failed = append(failed, msg)
continue
}
defer resp.Body.Close()
defer func() {
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
}()
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
sent = append(sent, msg)
if msg.AckFunc != nil { // Ack successful messages
Expand Down

0 comments on commit d933070

Please sign in to comment.