Class RateLimitChecker.LiteralValue
- java.lang.Object
-
- org.kohsuke.github.RateLimitChecker
-
- org.kohsuke.github.RateLimitChecker.LiteralValue
-
- Enclosing class:
- RateLimitChecker
public static class RateLimitChecker.LiteralValue extends RateLimitChecker
ARateLimitCheckerwith a simple number as the limit.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.kohsuke.github.RateLimitChecker
RateLimitChecker.LiteralValue
-
-
Field Summary
-
Fields inherited from class org.kohsuke.github.RateLimitChecker
NONE
-
-
Constructor Summary
Constructors Constructor Description LiteralValue(int sleepAtOrBelow)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckRateLimit(GHRateLimit.Record record, long count)Decides whether the current request exceeds the allowed "rate limit" budget.-
Methods inherited from class org.kohsuke.github.RateLimitChecker
sleepUntilReset
-
-
-
-
Method Detail
-
checkRateLimit
protected boolean checkRateLimit(GHRateLimit.Record record, long count) throws InterruptedException
Description copied from class:RateLimitCheckerDecides whether the current request exceeds the allowed "rate limit" budget. If this determines the rate limit will be exceeded, this method should sleep for some amount of time and must returntrue. Implementers are free to choose whatever strategy they prefer for what is considered to exceed the budget and how long to sleep.The caller of this method figures out which
GHRateLimit.Recordapplies for the current request add provides it to this method.It is important to remember that rate limit reset times are only accurate to the second. Trying to sleep to exactly the reset time would be likely to produce worse behavior rather than better. For this reason
GitHubRateLimitCheckermay choose to add more sleep times when a checker indicates the rate limit was exceeded.As long as this method returns
trueit is guaranteed thatGitHubRateLimitCheckerwill get updated rate limit information and call this method again withcountincremented by one. After this method returnstrueat least once, the callingGitHubRateLimitCheckermay choose to wait some additional period of time between calls to this checker.After this checker returns
false, the callingGitHubRateLimitCheckerwill let the request continue. If this method returnedtrueat least once for a particular request, the callingGitHubRateLimitCheckermay choose to wait some additional period of time before letting the request be sent.- Overrides:
checkRateLimitin classRateLimitChecker- Parameters:
record- the currentGHRateLimit.Recordto check against.count- the number of times in a row this method has been called for the current request- Returns:
falseif the current request does not exceed the allowed budget,trueif the current request exceeded the budget.- Throws:
InterruptedException- if the thread is interrupted while sleeping
-
-