Skip to content

Commit

Permalink
fix default value for maxIdleConnsPerHost (#46)
Browse files Browse the repository at this point in the history
* fix default value for maxIdleConnsPerHost

Signed-off-by: taniwa <[email protected]>

* Add warning log if rsa key (#43)

* Add warning log if rsa key

Signed-off-by: taniwa <[email protected]>

* fix wan log

Signed-off-by: taniwa <[email protected]>

---------

Signed-off-by: taniwa <[email protected]>

* fix

Signed-off-by: taniwa <[email protected]>

---------

Signed-off-by: taniwa <[email protected]>
  • Loading branch information
t4niwa authored Sep 19, 2024
1 parent 164f55a commit 3dea2d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import (
"github.com/AthenZ/authorization-proxy/v4/service"
)

// defaultMaxIdleConnsPerHost is the default value for transport MaxIdleConnsPerHost
const defaultMaxIdleConnsPerHost = 100

// Func represents the a handle function type
type Func func(http.ResponseWriter, *http.Request) error

Expand Down Expand Up @@ -139,6 +142,7 @@ func transportFromCfg(cfg config.Transport) *http.Transport {
if !isZero(cfg.MaxIdleConns) {
t.MaxIdleConns = cfg.MaxIdleConns
}
t.MaxIdleConnsPerHost = defaultMaxIdleConnsPerHost
if !isZero(cfg.MaxIdleConnsPerHost) {
t.MaxIdleConnsPerHost = cfg.MaxIdleConnsPerHost
}
Expand Down
4 changes: 3 additions & 1 deletion handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,9 @@ func Test_transportFromCfg(t *testing.T) {
args: args{
cfg: config.Transport{},
},
want: &http.Transport{},
want: &http.Transport{
MaxIdleConnsPerHost: 100,
},
},
{
name: "transport from custom values",
Expand Down

0 comments on commit 3dea2d9

Please sign in to comment.