Skip to content

Commit 80af440

Browse files
committed
add comments
1 parent b9335a3 commit 80af440

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/deploymentrecord/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,14 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
241241
}
242242

243243
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
244+
// Drain and close response body to enable connection reuse
244245
_, _ = io.Copy(io.Discard, resp.Body)
245246
_ = resp.Body.Close()
246247
dtmetrics.PostDeploymentRecordOk.Inc()
247248
return nil
248249
}
249250

250-
// Read response body for error messages
251+
// Drain and close response body to enable connection reuse by reading body for error logging
251252
body, _ := io.ReadAll(resp.Body)
252253
_ = resp.Body.Close()
253254

0 commit comments

Comments
 (0)