Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,7 @@ public static class Builder
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put(
"non_idempotent",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

Expand All @@ -516,15 +514,37 @@ public static class Builder
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5L))
.setInitialRetryDelay(Duration.ofMillis(1000L))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration.ofSeconds(1) is easier to read

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is autogenerated by gapic-generator. So it would have to change in its templates

.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build();
definitions.put("default", settings);
definitions.put("idempotent_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(0L))
.setRetryDelayMultiplier(1.0)
.setMaxRetryDelay(Duration.ofMillis(0L))
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("non_idempotent_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(0L))
.setRetryDelayMultiplier(1.0)
.setMaxRetryDelay(Duration.ofMillis(0L))
.setInitialRpcTimeout(Duration.ofMillis(300000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build();
definitions.put("non_idempotent_heavy_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

Expand Down Expand Up @@ -619,99 +639,99 @@ private static Builder initDefaults(Builder builder) {
builder
.createInstanceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params"));

builder
.getInstanceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.listInstancesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.partialUpdateInstanceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.deleteInstanceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.createClusterSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.getClusterSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.listClustersSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.updateClusterSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.deleteClusterSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.createAppProfileSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.getAppProfileSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.listAppProfilesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.updateAppProfileSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.deleteAppProfileSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.getIamPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));

builder
.setIamPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"));

builder
.testIamPermissionsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"));
builder
.createInstanceOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<CreateInstanceRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Instance.class))
Expand All @@ -726,15 +746,15 @@ private static Builder initDefaults(Builder builder) {
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build()));
builder
.partialUpdateInstanceOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<PartialUpdateInstanceRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Instance.class))
Expand All @@ -749,15 +769,15 @@ private static Builder initDefaults(Builder builder) {
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build()));
builder
.createClusterOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<CreateClusterRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Cluster.class))
Expand All @@ -766,20 +786,20 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(500L))
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(21600000L))
.build()));
builder
.updateClusterOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.<Cluster, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Cluster.class))
Expand All @@ -794,15 +814,15 @@ private static Builder initDefaults(Builder builder) {
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build()));
builder
.updateAppProfileOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<UpdateAppProfileRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(AppProfile.class))
Expand All @@ -811,13 +831,13 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5L))
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO) // ignored
.setRpcTimeoutMultiplier(1.0) // ignored
.setMaxRpcTimeout(Duration.ZERO) // ignored
.setTotalTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.build()));

return builder;
Expand Down
Loading