RFR: 2122: Minor bot optimizations for GitHub API

Zhao Song zsong at openjdk.org
Mon Dec 18 15:51:38 UTC 2023


On Fri, 15 Dec 2023 22:09:37 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> I've made some minor optimizations to some GitHub interactions that I would like to integrate. They don't make a big impact on their own, but are part of a bigger effort to reduce latency in certain bots. The idea is to reduce the number of individual calls when possible, as we are limiting calls for rate limits through global locks. We spend a lot of time waiting on those locks, so reducing the number of calls can be valuable.
> 
> When listing ReviewComments on GitHub, we need to fetch commit data in order to correctly generate all the file and line data for the comment. However, in most cases we don't actually need this data. I propose implementing an alternate method on PullRequest to retrieve ReviewComments as a list of regular Comment objects, without the file and line data.
> 
> When listing comments of various kinds, we are often hitting pagination. The default page size on GitHub is usually 30 with 100 being the max. Our methods for listing comments always fetch all of them, so it would make sense to use the max page size to reduce the number of individual calls.

Looks good!

forge/src/main/java/org/openjdk/skara/forge/github/GitHubPullRequest.java line 263:

> 261:     }
> 262: 
> 263:     public List<ReviewComment> reviewComments(boolean includeLocationData) {

Can we make this method private?

-------------

Marked as reviewed by zsong (Reviewer).

PR Review: https://git.openjdk.org/skara/pull/1593#pullrequestreview-1785551316
PR Review Comment: https://git.openjdk.org/skara/pull/1593#discussion_r1429308083


More information about the skara-dev mailing list