Unnecessary API requests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 1.9k
- Avg merge
- 17m
- Merged PRs (30d)
- 2
Description
From my reading of the code, it seems that posting a Reaction to an Issue Comment results in two unnecessary get requests. I haven't been able to watch the actual network traffic to verify this though.
In the following example it looks like the two get requests will be mabe but are not needed.
# No API call because of lazy=True
repo = github.get_repo(repo_name, lazy=True)
# GET: /repos/{owner}/{repo}/issues/{id}
issue = repo.get_issue(number=issue_id)
# GET: /repos/{owner}/{repo}/issues/comments/{id}
comment = issue.get_comment(comment_id)
# POST: /repos/{owner}/{repo}/issues/comments/{id}/reactions
reaction = comment.create_reaction(reaction_type)
Is this right?
Can we add lazy to all get methods?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the calls in the example: repo.get_issue, issue.get_comment, and comment.create_reaction, then verify the actual network requests. Determine whether lazy behavior can apply to these and other get methods, with tests confirming that unnecessary GET requests are avoided without breaking the reaction flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100