Skip to content

Commit

Permalink
log a warning when total rate limit is exceeded
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Peter Aldershaab <[email protected]>
  • Loading branch information
lukaspj committed Jan 17, 2025
1 parent b56cb64 commit 53f6d4e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/events/vcs/github_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func NewGithubClient(hostname string, credentials GithubCredentials, config Gith
return nil, errors.Wrap(err, "error initializing github authentication transport")
}

transportWithRateLimit, err := github_ratelimit.NewRateLimitWaiterClient(transport.Transport, github_ratelimit.WithTotalSleepLimit(time.Minute, nil))
transportWithRateLimit, err := github_ratelimit.NewRateLimitWaiterClient(
transport.Transport,
github_ratelimit.WithTotalSleepLimit(time.Minute, func(callbackContext *github_ratelimit.CallbackContext) {
logger.Warn("github rate limit exceeded total sleep time, requests will fail to avoid penalties from github")
}))
if err != nil {
return nil, errors.Wrap(err, "error initializing github rate limit transport")
}
Expand Down

0 comments on commit 53f6d4e

Please sign in to comment.