-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Connection pooling does not appear to work since v2.6.0. Instead, a new connection is opened to the GitHub server for each request, causing a performance regression. I believe I have traced this down to the introduction of #3060. I will open a PR with a suggested fix.
Reproduction
import os, logging
logging.basicConfig(level=logging.DEBUG)
from github import Github, Auth
auth = Auth.Token(os.environ['GITHUB_TOKEN'])
g = Github(auth=auth)
print(list(g.get_user().get_repos()))Output (v2.5.0)
$ GITHUB_TOKEN=xxx python test.py
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=2 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=3 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=4 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=5 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=6 HTTP/1.1" 200 None
Output (v2.6.0 through current main branch)
$ GITHUB_TOKEN=xxx python test.py
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=2 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=3 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=4 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?page=5 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
scotthew1 and ranamit112
Metadata
Metadata
Assignees
Labels
No labels