mirror of
https://github.com/google/nomulus
synced 2026-08-20 22:26:12 +00:00
Allow longer retries in Retrier for Spec11 (#3209)
We're getting some 429 (too many requests) responses from the SafeBrowsing API which is causing the Spec11 pipeline to fail. Currently the retrier is set to have a backoff starting at 100ms and only have a couple retries before failing (the latter is already configurable). For 429s, we want to wait significantly longer. Let's start at one second of waiting and allow four doublings.
This commit is contained in:
@@ -102,12 +102,12 @@ public class SafeBrowsingTransforms {
|
||||
* because class methods are generally serializable, especially a static function such as {@link
|
||||
* HttpClients#createDefault()}.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
EvaluateSafeBrowsingFn(String apiKey, Retrier retrier, Clock clock) {
|
||||
this.apiKey = apiKey;
|
||||
this.retrier = retrier;
|
||||
this.clock = clock;
|
||||
closeableHttpClientSupplier = (Supplier & Serializable) HttpClients::createDefault;
|
||||
this(
|
||||
apiKey,
|
||||
retrier,
|
||||
clock,
|
||||
(Supplier<CloseableHttpClient> & Serializable) HttpClients::createDefault);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +122,7 @@ public class SafeBrowsingTransforms {
|
||||
this.apiKey = apiKey;
|
||||
this.retrier = retrier;
|
||||
this.clock = clock;
|
||||
closeableHttpClientSupplier = clientSupplier;
|
||||
this.closeableHttpClientSupplier = clientSupplier;
|
||||
}
|
||||
|
||||
/** Evaluates any buffered {@link DomainNameInfo} objects upon completing the bundle. */
|
||||
|
||||
@@ -29,6 +29,7 @@ import google.registry.model.reporting.Spec11ThreatMatch.ThreatType;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.Retrier;
|
||||
import google.registry.util.Sleeper;
|
||||
import google.registry.util.UtilsModule;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.io.Serializable;
|
||||
@@ -238,8 +239,11 @@ public class Spec11Pipeline implements Serializable {
|
||||
|
||||
@Provides
|
||||
EvaluateSafeBrowsingFn provideSafeBrowsingFn(
|
||||
Spec11PipelineOptions options, Retrier retrier, Clock clock) {
|
||||
return new EvaluateSafeBrowsingFn(options.getSafeBrowsingApiKey(), retrier, clock);
|
||||
Spec11PipelineOptions options, Clock clock, Sleeper sleeper) {
|
||||
// Have a noticeably longer backoff for SafeBrowsing retries to mitigate any 429s
|
||||
Retrier safeBrowsingRetrier = new Retrier(sleeper, 4, 1000L);
|
||||
return new EvaluateSafeBrowsingFn(
|
||||
options.getSafeBrowsingApiKey(), safeBrowsingRetrier, clock);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -999,6 +999,12 @@ public final class RegistryConfig {
|
||||
return config.misc.transientFailureRetries;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("transientFailureBaseIntervalMillis")
|
||||
public static long provideTransientFailureBaseIntervalMillis() {
|
||||
return 100L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum number of results to return for an RDAP search query
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user