Class BulkOptions
java.lang.Object
lol.trq.alts.bulk.BulkOptions
How a bulk run should pace itself.
A final class rather than a record since 1.0.0, so a later setting is an addition and not a break:
start from defaults() or of(int, Duration, int, Duration, boolean), and derive copies with the withX methods. Two options are
equal when every setting is.
- Since:
- 0.9.0
-
Method Summary
Modifier and TypeMethodDescriptionintReturns how many entries may be in flight at once.static BulkOptionsdefaults()Returns the defaults: four at a time, a quarter second apart, two retries growing from two seconds, stopping if the service says to slow down.booleanReturns whetheroholds the same settings.inthashCode()Returns a hash over every setting, consistent withequals(Object).intReturns how many times a retryable failure is retried, beyond the first attempt.Returns the least time between two entries starting.static BulkOptionsof(int concurrency, Duration minSpacing, int maxRetries, Duration retryBaseDelay, boolean stopOnRateLimit) Creates options with every pacing setting given and no route tag.Returns the delay a retry grows from when the service asked for nothing specific.routeTag()Returns the route tag an import's sign-ins carry, on every request, to the proxy provider; seewithRouteTag(String).booleanReturns whether a rate limit ends the run rather than being waited out; a limit counts whether or not the service said how long to wait.toString()Returns every setting, in the form the record printed them.withConcurrency(int value) Returns a copy running the given number of entries at once.Returns a copy that keeps going through a rate limit, waiting each one out: for as long as the service asked, or on a growing delay when it named no wait.withRouteTag(String tag) Returns a copy whose import signs every credential in throughAltLoginService.routed(tag): every request of every entry, on every hop, reaches the proxy provider withtagas itsNetworkScope.routeTag().
-
Method Details
-
defaults
Returns the defaults: four at a time, a quarter second apart, two retries growing from two seconds, stopping if the service says to slow down.They are deliberately unambitious. The failure this pacing exists to avoid is a source address earning a longer ban, and the cost of being slower than necessary is a sweep that takes another minute.
- Returns:
- the default options
- Since:
- 0.9.0
-
of
public static BulkOptions of(int concurrency, Duration minSpacing, int maxRetries, Duration retryBaseDelay, boolean stopOnRateLimit) Creates options with every pacing setting given and no route tag.- Parameters:
concurrency- how many entries may be in flight at once; at least 1minSpacing- the least time between two entries starting; null or negative is zeromaxRetries- how many times a retryable failure is retried, beyond the first attempt; not negativeretryBaseDelay- the delay a retry grows from when the service asked for nothing specific; null or negative is zerostopOnRateLimit- whether a rate limit ends the run rather than being waited out- Returns:
- the options
- Throws:
IllegalArgumentException- ifconcurrencyis below 1 ormaxRetriesis negative- Since:
- 1.0.0
-
concurrency
public int concurrency()Returns how many entries may be in flight at once.- Returns:
- the concurrency, at least 1
- Since:
- 0.9.0
-
minSpacing
Returns the least time between two entries starting.- Returns:
- the spacing, never negative
- Since:
- 0.9.0
-
maxRetries
public int maxRetries()Returns how many times a retryable failure is retried, beyond the first attempt.- Returns:
- the retry count, never negative
- Since:
- 0.9.0
-
retryBaseDelay
Returns the delay a retry grows from when the service asked for nothing specific.- Returns:
- the base delay, never negative
- Since:
- 0.9.0
-
stopOnRateLimit
public boolean stopOnRateLimit()Returns whether a rate limit ends the run rather than being waited out; a limit counts whether or not the service said how long to wait.- Returns:
- whether the run stops on a rate limit
- Since:
- 0.9.0
-
routeTag
Returns the route tag an import's sign-ins carry, on every request, to the proxy provider; seewithRouteTag(String).- Returns:
- the tag, or empty for none
- Since:
- 1.0.0
-
withConcurrency
Returns a copy running the given number of entries at once.- Parameters:
value- how many entries may be in flight- Returns:
- a copy with the concurrency replaced
- Since:
- 0.9.0
-
withoutStoppingOnRateLimit
Returns a copy that keeps going through a rate limit, waiting each one out: for as long as the service asked, or on a growing delay when it named no wait. The whole run pauses for the wait, and an entry that is still limited aftermaxRetrieswaits fails.Worth knowing what that trades: continuing to send to a service that has asked you to stop is how an address earns a longer ban than the one it is already serving.
- Returns:
- a copy that does not stop early
- Since:
- 0.9.0
-
withRouteTag
Returns a copy whose import signs every credential in throughAltLoginService.routed(tag): every request of every entry, on every hop, reaches the proxy provider withtagas itsNetworkScope.routeTag(). For a host that pins accounts to proxies and wants a batch of new accounts to sign in through one it chose. OnlyimportCredentialsreads it; the runs over stored accounts name the account on every hop instead.nulldoes not clear the tag: it throws. Options without a tag are the ones built without this call.- Parameters:
tag- the route tag- Returns:
- a copy with the tag set
- Throws:
NullPointerException- iftagis nullIllegalArgumentException- iftagis blank- Since:
- 1.0.0
-
equals
-
hashCode
public int hashCode()Returns a hash over every setting, consistent withequals(Object). -
toString
-