From 009a22801a5cad26a2d0f2e7f05f42cf507e9715 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 8 Sep 2021 10:56:31 -0700 Subject: [PATCH] fix: extend timeout on batch translation requests (#775) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: extend timeout on batch translation requests * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../src/main/java/com/example/translate/BatchTranslateText.java | 2 +- .../com/example/translate/BatchTranslateTextWithGlossary.java | 2 +- .../translate/BatchTranslateTextWithGlossaryAndModel.java | 2 +- .../java/com/example/translate/BatchTranslateTextWithModel.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/translate/snippets/src/main/java/com/example/translate/BatchTranslateText.java b/translate/snippets/src/main/java/com/example/translate/BatchTranslateText.java index d36b9962b15..6f0f20138dd 100644 --- a/translate/snippets/src/main/java/com/example/translate/BatchTranslateText.java +++ b/translate/snippets/src/main/java/com/example/translate/BatchTranslateText.java @@ -88,7 +88,7 @@ public static void batchTranslateText( System.out.println("Waiting for operation to complete..."); // random number between 300 - 450 (maximum allowed seconds) - long randomNumber = ThreadLocalRandom.current().nextInt(300, 450); + long randomNumber = ThreadLocalRandom.current().nextInt(450, 600); BatchTranslateResponse response = future.get(randomNumber, TimeUnit.SECONDS); System.out.printf("Total Characters: %s\n", response.getTotalCharacters()); diff --git a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossary.java b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossary.java index 1e0eba9bbe7..6c5b713c9bc 100644 --- a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossary.java +++ b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossary.java @@ -106,7 +106,7 @@ public static void batchTranslateTextWithGlossary( System.out.println("Waiting for operation to complete..."); // random number between 300 - 450 (maximum allowed seconds) - long randomNumber = ThreadLocalRandom.current().nextInt(300, 450); + long randomNumber = ThreadLocalRandom.current().nextInt(450, 600); BatchTranslateResponse response = future.get(randomNumber, TimeUnit.SECONDS); // Display the translation for each input text provided diff --git a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossaryAndModel.java b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossaryAndModel.java index d6df08adbbf..0fe8bd26802 100644 --- a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossaryAndModel.java +++ b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithGlossaryAndModel.java @@ -113,7 +113,7 @@ public static void batchTranslateTextWithGlossaryAndModel( System.out.println("Waiting for operation to complete..."); // random number between 300 - 450 (maximum allowed seconds) - long randomNumber = ThreadLocalRandom.current().nextInt(300, 450); + long randomNumber = ThreadLocalRandom.current().nextInt(450, 600); BatchTranslateResponse response = future.get(randomNumber, TimeUnit.SECONDS); // Display the translation for each input text provided diff --git a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithModel.java b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithModel.java index da0624618b4..216a2060e30 100644 --- a/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithModel.java +++ b/translate/snippets/src/main/java/com/example/translate/BatchTranslateTextWithModel.java @@ -103,7 +103,7 @@ public static void batchTranslateTextWithModel( System.out.println("Waiting for operation to complete..."); // random number between 300 - 450 (maximum allowed seconds) - long randomNumber = ThreadLocalRandom.current().nextInt(300, 450); + long randomNumber = ThreadLocalRandom.current().nextInt(450, 600); BatchTranslateResponse response = future.get(randomNumber, TimeUnit.SECONDS); // Display the translation for each input text provided