Skip to content

Commit 3919e2b

Browse files
authored
Reduce the page size of GitHub history queries (#85)
1 parent 7a72a10 commit 3919e2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rooster/_github.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def get_pull_requests_for_commits(
145145
seen_commits = 0
146146
expected_commits = {str(commit.id) for commit in commits}
147147

148+
# Note we use `first: 10` on `history` because GitHub can otherwise
149+
# encounter an internal timeout and return a 502
148150
query = textwrap.dedent(
149151
"""
150152
query associatedPullRequest(
@@ -154,7 +156,7 @@ def get_pull_requests_for_commits(
154156
commit: object(expression: $commit) {
155157
... on Commit {
156158
id
157-
history(after: $after) {
159+
history(first: 10, after: $after) {
158160
nodes {
159161
oid
160162
associatedPullRequests(first: 1) {

0 commit comments

Comments
 (0)