Skip to content

Commit

Permalink
Merging to release-4-lts: Merging to release-4.3.8: [TT-9964] Prevent…
Browse files Browse the repository at this point in the history
… new idle connections to be generated. (#5526)

Merging to release-4.3.8: [TT-9964] Prevent new idle connections to be generated. (#5526)

[TT-9964] Prevent new idle connections to be generated. (#5526)
  • Loading branch information
buger authored Nov 6, 2023
1 parent 1e2370a commit 2988f8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gateway/api_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ func (s *APISpec) Release() {
if s.JSVM.VM != nil {
s.JSVM.DeInit()
}

if s.HTTPTransport != nil {
// Prevent new idle connections to be generated.
s.HTTPTransport.transport.DisableKeepAlives = true
s.HTTPTransport.transport.CloseIdleConnections()
}
}

// Validate returns nil if s is a valid spec and an error stating why the spec is not valid.
Expand Down
2 changes: 1 addition & 1 deletion gateway/api_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ func (gw *Gateway) loadApps(specs []*APISpec) {

for _, spec := range specs {
curSpec, ok := gw.apisByID[spec.APIID]
if ok && curSpec.Checksum != spec.Checksum {
if ok && shouldReloadSpec(curSpec, spec) {
curSpec.Release()
}
}
Expand Down

0 comments on commit 2988f8b

Please sign in to comment.