Skip to content

Make webhook http connections resuable #6976

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

Merged
merged 4 commits into from
May 21, 2019

Conversation

lunny
Copy link
Member

@lunny lunny commented May 17, 2019

The httplib will always create a new http.Client. That's no problem when there are few webhooks sent. But when you have hundreds of thousand webhooks to be sent, it will never reuse http connections. So let's keep only one http.Client for webhooks.

@lunny lunny added the type/enhancement An improvement of existing functionality label May 17, 2019
@lunny lunny added this to the 1.9.0 milestone May 17, 2019
@lunny lunny force-pushed the lunny/share_http_connection_webhook branch from ce068b1 to b293feb Compare May 19, 2019 13:45
@codecov-io
Copy link

codecov-io commented May 19, 2019

Codecov Report

Merging #6976 into master will increase coverage by 0.04%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6976      +/-   ##
=========================================
+ Coverage   41.45%   41.5%   +0.04%     
=========================================
  Files         441     440       -1     
  Lines       59699   59453     -246     
=========================================
- Hits        24747   24673      -74     
+ Misses      31727   31560     -167     
+ Partials     3225    3220       -5
Impacted Files Coverage Δ
models/webhook.go 56.73% <40%> (-3.03%) ⬇️
models/repo_indexer.go 66.52% <0%> (-2.12%) ⬇️
models/gpg_key.go 55.83% <0%> (-0.84%) ⬇️
modules/httplib/httplib.go
modules/log/colors_router.go 87.5% <0%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02542a2...7e2c671. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 19, 2019
Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it appears that at present we only have a single threaded user of the webhook client in deliver it might be better to make a pool and get/release.

Otherwise looks good

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 20, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 21, 2019
@lunny lunny merged commit 1f84970 into go-gitea:master May 21, 2019
@lunny lunny deleted the lunny/share_http_connection_webhook branch May 21, 2019 07:20
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
* make http connections resuable

* add error handler

* fix lint
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants