Class RetryOnRateLimitConfig
java.lang.Object
com.atlassian.bitbucket.jenkins.internal.http.RetryOnRateLimitConfig
- All Implemented Interfaces:
RequestConfiguration
Configuration for request re-try. The request will be tried up to {code maxAttempts} times with a wait between requests
as directed by the remote server (defaults to 5s for Bitbucket Server). A retry will happen if the remote side responds
with a HTTP status code of {code 429}. If the request is not successful within the allowed number of attempts an
RateLimitedException is thrown.- Since:
- 3.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(okhttp3.Request.Builder builder) Update the supplied builder with the configuration required.intintint
-
Constructor Details
-
RetryOnRateLimitConfig
public RetryOnRateLimitConfig(int maxAttempts) - Parameters:
maxAttempts- maximum number of times to attempt the request, inclusive.
-
-
Method Details
-
apply
public void apply(okhttp3.Request.Builder builder) Description copied from interface:RequestConfigurationUpdate the supplied builder with the configuration required. The order in which configurations are applied is not defined nor guaranteed to be the same between invocations.- Specified by:
applyin interfaceRequestConfiguration- Parameters:
builder- the request builder, someRequestConfigurations may already have been applied to the builder
-
getAttempts
public int getAttempts() -
getMaxAttempts
public int getMaxAttempts() -
incrementAndGetAttempts
public int incrementAndGetAttempts()
-