mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 08:03:13 +00:00
Scope remaining GitHub rate-limit accounting
This commit is contained in:
@@ -117,7 +117,6 @@ import { mapGraphQLReactionGroups, type GitHubGraphQLReactionGroup } from './com
|
||||
import {
|
||||
getRateLimit,
|
||||
noteRepositoryRateLimitSpend,
|
||||
rateLimitGuard,
|
||||
repositoryRateLimitGuard,
|
||||
spendsSharedGitHubComQuota,
|
||||
type RateLimitBucketKind
|
||||
@@ -189,11 +188,10 @@ async function assertRateLimitBudget(
|
||||
repository?: GitHubApiRepository | null,
|
||||
executionOptions?: Pick<GhExecOptions, 'wslDistro'>
|
||||
): Promise<void> {
|
||||
if (!spendsSharedGitHubComQuota(repository, executionOptions)) {
|
||||
return
|
||||
if (spendsSharedGitHubComQuota(repository, executionOptions)) {
|
||||
await getRateLimit()
|
||||
}
|
||||
await getRateLimit()
|
||||
const guard = rateLimitGuard(bucket)
|
||||
const guard = repositoryRateLimitGuard(repository, bucket, executionOptions)
|
||||
if (guard.blocked) {
|
||||
throw new Error(
|
||||
`GitHub ${bucket} rate limit is low; retry after ${new Date(guard.resetAt * 1000).toLocaleTimeString()}`
|
||||
|
||||
Reference in New Issue
Block a user