Skip to content

Commit

Permalink
close response body
Browse files Browse the repository at this point in the history
The IO buffer Body of HTTP response should be closed when exiting the function.
  • Loading branch information
xiekeyang committed Aug 6, 2018
1 parent 373c76e commit fe0d1d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/fnenv/fission/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ func (fe *FunctionEnv) Invoke(spec *types.TaskInvocationSpec) (*types.TaskInvoca
fnenv.FnActive.WithLabelValues(Name).Inc()
defer fnenv.FnExecTime.WithLabelValues(Name).Observe(float64(time.Since(timeStart)))
ctxLog.Infof("Invoking Fission function: '%v'.", req.URL)

resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, fmt.Errorf("error for reqUrl '%v': %v", url, err)
}
defer resp.Body.Close()

fnenv.FnActive.WithLabelValues(Name).Dec()
fnenv.FnActive.WithLabelValues(Name).Inc()

Expand Down

0 comments on commit fe0d1d6

Please sign in to comment.