Skip to content

Commit

Permalink
feat: handle GitHub secondary rate limiting (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfabio authored Jan 25, 2023
1 parent d87cf1f commit 0542e9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scanner/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ Retry:
time.Sleep(time.Until(resp.Rate.Reset.Time))
goto Retry
}
if _, ok := err.(*github.AbuseRateLimitError); ok {
log.Infof("GitHub secondary rate limit hit, sleeping until %s", resp.Rate.Reset.Time.String())
time.Sleep(time.Until(resp.Rate.Reset.Time))
goto Retry
}
if err != nil {
return fmt.Errorf("can't get repo %s: %w", url.String(), err)
}
Expand Down

0 comments on commit 0542e9a

Please sign in to comment.