Skip to content

Commit 134b459

Browse files
committed
network error when marking files in PR as viewed
Fixes #6953
1 parent 1233e48 commit 134b459

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/github/pullRequestModel.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export interface FileViewedStateChangeEvent {
112112

113113
export type FileViewedState = { [key: string]: ViewedState };
114114

115-
const BATCH_SIZE = 100;
115+
const BATCH_SIZE = 50;
116116

117117
export class PullRequestModel extends IssueModel<PullRequest> implements IPullRequestModel {
118118
static override ID = 'PullRequestModel';
@@ -2025,18 +2025,22 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
20252025
// We only ever send 100 mutations at once. Any more than this and
20262026
// we risk a timeout from GitHub.
20272027
for (let i = 0; i < allFilenames.length; i += BATCH_SIZE) {
2028-
const batch = allFilenames.slice(i, i + BATCH_SIZE);
2029-
// See below for an example of what a mutation produced by this
2030-
// will look like
2031-
const mutation = gql`mutation Batch${mutationName}{
2032-
${batch.map((filename, i) =>
2033-
`alias${i}: ${mutationName}(
2034-
input: {path: "${filename}", pullRequestId: "${pullRequestId}"}
2035-
) { clientMutationId }
2036-
`
2037-
)}
2038-
}`;
2039-
await mutate<void>({ mutation });
2028+
try {
2029+
const batch = allFilenames.slice(i, i + BATCH_SIZE);
2030+
// See below for an example of what a mutation produced by this
2031+
// will look like
2032+
const mutation = gql`mutation Batch${mutationName}{
2033+
${batch.map((filename, i) =>
2034+
`alias${i}: ${mutationName}(
2035+
input: {path: "${filename}", pullRequestId: "${pullRequestId}"}
2036+
) { clientMutationId }
2037+
`
2038+
)}
2039+
}`;
2040+
await mutate<void>({ mutation });
2041+
} catch (e) {
2042+
Logger.error(`Error marking files as ${state}: ${e}`, PullRequestModel.ID);
2043+
}
20402044
}
20412045

20422046
// mutation BatchUnmarkFileAsViewedInline {

0 commit comments

Comments
 (0)