-
Notifications
You must be signed in to change notification settings - Fork 742
*: close the response body when finished with it #3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: JmPotato <ghzpotato@gmail.com>
server/api/scheduler.go
Outdated
@@ -286,6 +286,7 @@ func (h *schedulerHandler) redirectSchedulerDelete(name, schedulerName string) e | |||
if err != nil { | |||
return err | |||
} | |||
defer resp.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closed in doDelete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
Codecov Report
@@ Coverage Diff @@
## master #3666 +/- ##
==========================================
+ Coverage 74.78% 74.82% +0.03%
==========================================
Files 245 245
Lines 24237 24238 +1
==========================================
+ Hits 18126 18136 +10
+ Misses 4508 4498 -10
- Partials 1603 1604 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Signed-off-by: JmPotato <ghzpotato@gmail.com>
server/server.go
Outdated
@@ -1337,6 +1337,7 @@ 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() | |||
} | |||
defer res.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about directly close instead of using defer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. PTAL again!
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 0fd4529
|
Kudos, SonarCloud Quality Gate passed!
|
* Close the response body when finished with it Signed-off-by: JmPotato <ghzpotato@gmail.com> * Remove a duplicate body close Signed-off-by: JmPotato <ghzpotato@gmail.com> * Address the comment Signed-off-by: JmPotato <ghzpotato@gmail.com> * Close the body immediately if there is no read Signed-off-by: JmPotato <ghzpotato@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
* change Signed-off-by: yisaer <disxiaofei@163.com> * fix go.sum Signed-off-by: yisaer <disxiaofei@163.com> * add comment Signed-off-by: yisaer <disxiaofei@163.com> * remove todo Signed-off-by: yisaer <disxiaofei@163.com> * fix test Signed-off-by: yisaer <disxiaofei@163.com> * add test Signed-off-by: yisaer <disxiaofei@163.com> * address the comment Signed-off-by: yisaer <disxiaofei@163.com> * address the comment Signed-off-by: yisaer <disxiaofei@163.com> * fix race Signed-off-by: yisaer <disxiaofei@163.com> * fix test Signed-off-by: yisaer <disxiaofei@163.com> address the comment Signed-off-by: yisaer <disxiaofei@163.com> * fix race Signed-off-by: yisaer <disxiaofei@163.com> * *: close the response body when finished with it (#3666) * Close the response body when finished with it Signed-off-by: JmPotato <ghzpotato@gmail.com> * Remove a duplicate body close Signed-off-by: JmPotato <ghzpotato@gmail.com> * Address the comment Signed-off-by: JmPotato <ghzpotato@gmail.com> * Close the body immediately if there is no read Signed-off-by: JmPotato <ghzpotato@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> * scheduler: replace `move-hot-read-peer` with `move-hot-read-leader` (#3657) * fix Signed-off-by: lhy1024 <admin@liudos.us> * address comment Signed-off-by: lhy1024 <admin@liudos.us> * address comment Signed-off-by: lhy1024 <admin@liudos.us> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> * *: clean up useless parameters (#3667) * Clean up useless parameters Signed-off-by: JmPotato <ghzpotato@gmail.com> * Define some const variables Signed-off-by: JmPotato <ghzpotato@gmail.com> Co-authored-by: ShuNing <nolouch@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> * dashboard: Update to TiDB Dashboard v2021.05.12.1 (#3670) * Update to TiDB Dashboard v2021.04.16.1 Signed-off-by: Suhaha <jklopsdfw@gmail.com> * Update to TiDB Dashboard v2021.05.12.1 Signed-off-by: Suhaha <jklopsdfw@gmail.com> Co-authored-by: 混沌DM <hundundm@gmail.com> * address the comment Signed-off-by: yisaer <disxiaofei@163.com> * address the comment Signed-off-by: yisaer <disxiaofei@163.com> * address the comment Signed-off-by: yisaer <disxiaofei@163.com> Co-authored-by: JmPotato <ghzpotato@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> Co-authored-by: lhy1024 <admin@liudos.us> Co-authored-by: ShuNing <nolouch@gmail.com> Co-authored-by: Suhaha <jklopsdfw@gmail.com> Co-authored-by: 混沌DM <hundundm@gmail.com>
Signed-off-by: JmPotato ghzpotato@gmail.com
What problem does this PR solve?
According to the overview of package "net/http", the client must close the response body when finished with it. This could be detected by:
What is changed and how it works?
Check List
Tests
Release note