Skip to content

Commit 3fdaef4

Browse files
committed
Update rate limit check interval
Signed-off-by: Patrick <patrick.weiss@iteratec.com>
1 parent ffa283e commit 3fdaef4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

scanners/git-repo-scanner/scanner/internal/git_repo_scanner/github_repo_scanner.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,17 @@ func (g *GitHubRepoScanner) respectGitHubRateLimit() error {
245245
return nil
246246
}
247247

248-
// Only check rate limit every 50 API calls OR every 30 seconds
249-
if g.requestsSinceCheck < 50 && time.Since(g.lastRateLimitCheck) < 30*time.Second {
248+
// Determine check interval based on authentication
249+
// For unauthenticated (60/hour), check more frequently
250+
checkInterval := 50
251+
if g.accessToken == "" {
252+
checkInterval = 5
253+
}
254+
255+
if g.requestsSinceCheck < checkInterval && time.Since(g.lastRateLimitCheck) < 30*time.Second {
250256
return nil
251257
}
252258

253-
// Reset counters
254259
g.requestsSinceCheck = 0
255260
g.lastRateLimitCheck = time.Now()
256261

0 commit comments

Comments
 (0)