Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Commit 9a07a5e

Browse files
fix: migrate retry configs to grpc_service_config (#217)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5c193786-fcd8-4a90-b8a2-1d007566f359/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 316899534 Source-Link: googleapis/googleapis@c625516 PiperOrigin-RevId: 316899150 Source-Link: googleapis/googleapis@791505d
1 parent d1a0e06 commit 9a07a5e

File tree

4 files changed

+53
-29
lines changed

4 files changed

+53
-29
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
1717
<dependency>
1818
<groupId>com.google.cloud</groupId>
1919
<artifactId>libraries-bom</artifactId>
20-
<version>5.7.0</version>
20+
<version>7.0.0</version>
2121
<type>pom</type>
2222
<scope>import</scope>
2323
</dependency>

google-cloud-speech/src/main/java/com/google/cloud/speech/v1/stub/SpeechStubSettings.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ public static class Builder extends StubSettings.Builder<SpeechStubSettings, Bui
219219
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
220220
ImmutableMap.builder();
221221
definitions.put(
222-
"idempotent",
222+
"retry_policy_1_codes",
223223
ImmutableSet.copyOf(
224224
Lists.<StatusCode.Code>newArrayList(
225-
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
226-
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
225+
StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
226+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
227+
definitions.put(
228+
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
227229
RETRYABLE_CODE_DEFINITIONS = definitions.build();
228230
}
229231

@@ -237,12 +239,22 @@ public static class Builder extends StubSettings.Builder<SpeechStubSettings, Bui
237239
.setInitialRetryDelay(Duration.ofMillis(100L))
238240
.setRetryDelayMultiplier(1.3)
239241
.setMaxRetryDelay(Duration.ofMillis(60000L))
240-
.setInitialRpcTimeout(Duration.ofMillis(1000000L))
242+
.setInitialRpcTimeout(Duration.ofMillis(5000000L))
243+
.setRpcTimeoutMultiplier(1.0)
244+
.setMaxRpcTimeout(Duration.ofMillis(5000000L))
245+
.setTotalTimeout(Duration.ofMillis(5000000L))
246+
.build();
247+
definitions.put("retry_policy_1_params", settings);
248+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
249+
definitions.put("no_retry_params", settings);
250+
settings =
251+
RetrySettings.newBuilder()
252+
.setInitialRpcTimeout(Duration.ofMillis(5000000L))
241253
.setRpcTimeoutMultiplier(1.0)
242-
.setMaxRpcTimeout(Duration.ofMillis(1000000L))
254+
.setMaxRpcTimeout(Duration.ofMillis(5000000L))
243255
.setTotalTimeout(Duration.ofMillis(5000000L))
244256
.build();
245-
definitions.put("default", settings);
257+
definitions.put("no_retry_1_params", settings);
246258
RETRY_PARAM_DEFINITIONS = definitions.build();
247259
}
248260

@@ -281,20 +293,20 @@ private static Builder initDefaults(Builder builder) {
281293

282294
builder
283295
.recognizeSettings()
284-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
285-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
296+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
297+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
286298

287299
builder
288300
.longRunningRecognizeSettings()
289-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
290-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
301+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
302+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
291303
builder
292304
.longRunningRecognizeOperationSettings()
293305
.setInitialCallSettings(
294306
UnaryCallSettings
295307
.<LongRunningRecognizeRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
296-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
297-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
308+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
309+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
298310
.build())
299311
.setResponseTransformer(
300312
ProtoOperationTransformers.ResponseTransformer.create(

google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/stub/SpeechStubSettings.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ public static class Builder extends StubSettings.Builder<SpeechStubSettings, Bui
219219
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
220220
ImmutableMap.builder();
221221
definitions.put(
222-
"idempotent",
222+
"retry_policy_1_codes",
223223
ImmutableSet.copyOf(
224224
Lists.<StatusCode.Code>newArrayList(
225225
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
226-
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
226+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
227+
definitions.put(
228+
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
227229
RETRYABLE_CODE_DEFINITIONS = definitions.build();
228230
}
229231

@@ -237,12 +239,22 @@ public static class Builder extends StubSettings.Builder<SpeechStubSettings, Bui
237239
.setInitialRetryDelay(Duration.ofMillis(100L))
238240
.setRetryDelayMultiplier(1.3)
239241
.setMaxRetryDelay(Duration.ofMillis(60000L))
240-
.setInitialRpcTimeout(Duration.ofMillis(1000000L))
242+
.setInitialRpcTimeout(Duration.ofMillis(5000000L))
243+
.setRpcTimeoutMultiplier(1.0)
244+
.setMaxRpcTimeout(Duration.ofMillis(5000000L))
245+
.setTotalTimeout(Duration.ofMillis(5000000L))
246+
.build();
247+
definitions.put("retry_policy_1_params", settings);
248+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
249+
definitions.put("no_retry_params", settings);
250+
settings =
251+
RetrySettings.newBuilder()
252+
.setInitialRpcTimeout(Duration.ofMillis(5000000L))
241253
.setRpcTimeoutMultiplier(1.0)
242-
.setMaxRpcTimeout(Duration.ofMillis(1000000L))
254+
.setMaxRpcTimeout(Duration.ofMillis(5000000L))
243255
.setTotalTimeout(Duration.ofMillis(5000000L))
244256
.build();
245-
definitions.put("default", settings);
257+
definitions.put("no_retry_1_params", settings);
246258
RETRY_PARAM_DEFINITIONS = definitions.build();
247259
}
248260

@@ -281,20 +293,20 @@ private static Builder initDefaults(Builder builder) {
281293

282294
builder
283295
.recognizeSettings()
284-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
285-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
296+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
297+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
286298

287299
builder
288300
.longRunningRecognizeSettings()
289-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
290-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
301+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
302+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
291303
builder
292304
.longRunningRecognizeOperationSettings()
293305
.setInitialCallSettings(
294306
UnaryCallSettings
295307
.<LongRunningRecognizeRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
296-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
297-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
308+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
309+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
298310
.build())
299311
.setResponseTransformer(
300312
ProtoOperationTransformers.ResponseTransformer.create(

synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/java-speech.git",
7-
"sha": "cc7ae23507808c0d9619e6f081016cdb8aefc5ac"
7+
"sha": "bf5f2b8faf58b2096737ee679ffcaae3229a84f9"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "c4e37010d74071851ff24121f522e802231ac86e",
15-
"internalRef": "313460921"
14+
"sha": "c62551667895c73daec0fb232c348f845caddf0f",
15+
"internalRef": "316899534"
1616
}
1717
},
1818
{
1919
"git": {
2020
"name": "googleapis",
2121
"remote": "https://github.com/googleapis/googleapis.git",
22-
"sha": "c4e37010d74071851ff24121f522e802231ac86e",
23-
"internalRef": "313460921"
22+
"sha": "c62551667895c73daec0fb232c348f845caddf0f",
23+
"internalRef": "316899534"
2424
}
2525
},
2626
{

0 commit comments

Comments
 (0)