Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(speech): increment retry setting values and test timeout values in IT #9188

Merged
merged 9 commits into from
Mar 4, 2023
2 changes: 0 additions & 2 deletions java-speech/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Java idiomatic client for [Cloud Speech][product-docs].

If you are using Maven, add this to your pom.xml file:

<!--- {x-version-update-start:google-cloud-speech:released} -->
Copy link
Member

Choose a reason for hiding this comment

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

@ddixit14 Why is OwlBot removing this?


```xml
<dependency>
Expand All @@ -35,7 +34,6 @@ If you are using SBT, add this to your dependencies:
```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-speech" % "4.7.0"
```
<!--- {x-version-update-end} -->

## Authentication

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

package com.google.cloud.speech.v1.it;

import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.retrying.TimedRetryAlgorithm;
import com.google.api.gax.rpc.ApiStreamObserver;
import com.google.cloud.speech.v1.LongRunningRecognizeResponse;
import com.google.cloud.speech.v1.RecognitionAudio;
import com.google.cloud.speech.v1.RecognitionConfig;
import com.google.cloud.speech.v1.RecognizeResponse;
import com.google.cloud.speech.v1.SpeechClient;
import com.google.cloud.speech.v1.SpeechSettings;
import com.google.cloud.speech.v1.StreamingRecognitionConfig;
import com.google.cloud.speech.v1.StreamingRecognizeRequest;
import com.google.cloud.speech.v1.StreamingRecognizeResponse;
Expand All @@ -34,15 +38,32 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
import org.threeten.bp.Duration;

public class ITSpeechTest {
private static SpeechClient speechClient;

@Rule public Timeout globalTimeout = Timeout.seconds(300);
@Rule public Timeout globalTimeout = Timeout.seconds(1000);

@BeforeClass
public static void setupClass() throws Exception {
speechClient = SpeechClient.create();
TimedRetryAlgorithm timedRetryAlgorithm =
OperationTimedPollAlgorithm.create(
// These values are copied from com.google.cloud.speech.v1.stub.SpeechStubSettings...
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMinutes(10))
.build());
SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder();
settingsBuilder
.longRunningRecognizeOperationSettings()
.setPollingAlgorithm(timedRetryAlgorithm);
speechClient = SpeechClient.create(settingsBuilder.build());
}

@AfterClass
Expand Down