Skip to content

Commit

Permalink
Merge branch 'master' into fix-move-peer
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored May 12, 2021
2 parents ad4720a + 1faef48 commit 7c7b62a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/api/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func changeLeaderPeerUrls(c *C, leader *pdpb.Member, id uint64, urls []string) {
resp, err := testDialClient.Do(req)
c.Assert(err, IsNil)
c.Assert(resp.StatusCode, Equals, 204)
resp.Body.Close()
}

type testResignAPISuite struct {
Expand Down
2 changes: 2 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,8 @@ func (s *Server) ReplicateFileToAllMembers(ctx context.Context, name string, dat
log.Warn("failed to replicate file", zap.String("name", name), zap.String("member", member.GetName()), errs.ZapError(err))
return errs.ErrSendRequest.Wrap(err).GenWithStackByCause()
}
// Since we don't read the body, we can close it immediately.
res.Body.Close()
if res.StatusCode != http.StatusOK {
log.Warn("failed to replicate file", zap.String("name", name), zap.String("member", member.GetName()), zap.Int("status-code", res.StatusCode))
return errs.ErrSendRequest.FastGenByArgs()
Expand Down

0 comments on commit 7c7b62a

Please sign in to comment.