Skip to content
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

Can we expose the timeout parameter to Repository.create_tree() to create large tree objects? #1187

Open
rduve opened this issue Jul 25, 2024 · 0 comments

Comments

@rduve
Copy link

rduve commented Jul 25, 2024

Currently, when trying to create a tree with large data there is a timeout error:

import github3

gh = github3.login(token=<token>)
repo = gh.repository(<org>, <repo>)
...
# Make big tree_data and tree_sha here.
...
tree = repo.create_tree(tree_data, tree_sha)

github3.exceptions.ConnectionError: <class 'requests.exceptions.ReadTimeout'>: A connection-level exception occurred: HTTPSConnectionPool(host='api.github.com', port=443): Read timed out. (read timeout=10)

Specifically, that tree_data object has 1610 blobs and is about 300 KB serialized.

Manually adding a timeout=60 to the self._post() in that function:

json = self._json(self._post(url, data=data), 201)

allows the tree to successfully be created.

My goal is to not get the timeout when executing create_tree. Would it be a helpful addition to github3 if that timeout could be specified without patching the _post function? If not, would a PR that adds timeout to the create_tree function contract be welcome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant