Skip to content

Commit

Permalink
Merge pull request #44 from Comcast/fix/connection-reuse-on-outbound
Browse files Browse the repository at this point in the history
Close the body and re-use the connection.
  • Loading branch information
njharter authored Aug 16, 2017
2 parents 25da7b1 + a495546 commit a9996df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/caduceus/outboundSender.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"github.com/Comcast/webpa-common/logging"
"github.com/Comcast/webpa-common/webhook"
"hash"
"io"
"io/ioutil"
"net/http"
"net/url"
"regexp"
Expand Down Expand Up @@ -432,6 +434,13 @@ func (obs *CaduceusOutboundSender) worker(id int) {
work.req.Telemetry.Status = TelemetryStatusPartialSuccess
obs.profiler.Send(work.req.Telemetry)
}

// read until the response is complete before closing to allow
// connection reuse
if nil != resp.Body {
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
}
}
}
}
Expand Down

0 comments on commit a9996df

Please sign in to comment.