feat(sync): add Octokit retry/throttle and rate-limited status

This commit is contained in:
Gabriel Brown committed 2026-07-11 14:28:02 -04:00
1 parent f1dbf8cd50
commit 4769a76274
7 files changed
+104 -4

No files matched your search

+6 -2
View File
@@ -13,6 +13,7 @@ import {
getInstallationOctokit,
getRepository,
getSpoonInstallationId,
isRateLimitError,
listPullRequests,
syncForkBranch,
} from './githubClient';
@@ -360,13 +361,16 @@ const refreshOwnedSpoon = async (
};
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
const rateLimited = isRateLimitError(error);
await Promise.all([
ctx.runMutation(internal.spoons.patchSyncFields, {
spoonId,
syncStatus: 'error',
syncStatus: rateLimited ? 'rate_limited' : 'error',
lastGithubRefreshAt: Date.now(),
lastCheckedAt: Date.now(),
lastError: message,
lastError: rateLimited
? `Rate limited by GitHub; will retry. ${message}`
: message,
}),
ctx.runMutation(internal.syncRuns.patchInternal, {
syncRunId,