@@ -48,12 +48,16 @@ public final class RetryParams implements Serializable {
4848
4949 private static final long serialVersionUID = -8492751576749007700L ;
5050
51+ /**
52+ * Note that App Engine Standard Environment front-end modules have a 60 second deadline for HTTP
53+ * requests. For that reason, we set the default total retry period to less than 60 seconds.
54+ */
55+ public static final long DEFAULT_TOTAL_RETRY_PERIOD_MILLIS = 50_000L ;
5156 public static final int DEFAULT_RETRY_MIN_ATTEMPTS = 3 ;
5257 public static final int DEFAULT_RETRY_MAX_ATTEMPTS = 6 ;
53- public static final long DEFAULT_INITIAL_RETRY_DELAY_MILLIS = 250L ;
54- public static final long DEFAULT_MAX_RETRY_DELAY_MILLIS = 10_000L ;
58+ public static final long DEFAULT_INITIAL_RETRY_DELAY_MILLIS = 1000L ;
59+ public static final long DEFAULT_MAX_RETRY_DELAY_MILLIS = 32_000L ;
5560 public static final double DEFAULT_RETRY_DELAY_BACKOFF_FACTOR = 2.0 ;
56- public static final long DEFAULT_TOTAL_RETRY_PERIOD_MILLIS = 50_000L ;
5761
5862 private final int retryMinAttempts ;
5963 private final int retryMaxAttempts ;
@@ -62,6 +66,9 @@ public final class RetryParams implements Serializable {
6266 private final double retryDelayBackoffFactor ;
6367 private final long totalRetryPeriodMillis ;
6468
69+ // Some services may have different backoff requirements listed in their SLAs. Be sure to override
70+ // ServiceOptions.defaultRetryParams() in options subclasses when the service's backoff
71+ // requirement differs from the default parameters used here.
6572 private static final RetryParams DEFAULT_INSTANCE = new RetryParams (new Builder ());
6673 private static final RetryParams NO_RETRIES =
6774 builder ().retryMaxAttempts (1 ).retryMinAttempts (1 ).build ();
@@ -156,7 +163,9 @@ public Builder retryDelayBackoffFactor(double retryDelayBackoffFactor) {
156163 }
157164
158165 /**
159- * Sets totalRetryPeriodMillis.
166+ * Sets totalRetryPeriodMillis. Note that App Engine Standard Environment front-end modules have
167+ * a 60 second deadline for HTTP requests. For that reason, you should set the total retry
168+ * period to under 60 seconds if you are using it on an App Engine front-end module.
160169 *
161170 * @param totalRetryPeriodMillis the totalRetryPeriodMillis to set
162171 * @return the Builder for chaining
@@ -295,4 +304,8 @@ public String toString() {
295304 public static Builder builder () {
296305 return new Builder ();
297306 }
307+
308+ public Builder toBuilder () {
309+ return new Builder (this );
310+ }
298311}
0 commit comments