From 3f3c13e7fcbf08b8ab6f0d11d7451b3ae86c9500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Thu, 29 Apr 2021 02:34:22 +0200 Subject: [PATCH] docs: use default timeout for restore operation (#1109) The restore operation should use the default timeout of a restore operation. Although that timeout is long, the tests for the samples are only executed as part of the nightly build, which means that a long-running restore will not slow down PR builds. Fixes #1019 --- .../example/spanner/RestoreBackupWithEncryptionKey.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java b/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java index 4635031c0a..fa87d98151 100644 --- a/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java +++ b/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java @@ -30,8 +30,6 @@ import com.google.cloud.spanner.encryption.EncryptionConfigs; import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; public class RestoreBackupWithEncryptionKey { @@ -71,7 +69,7 @@ static Void restoreBackupWithEncryptionKey(DatabaseAdminClient adminClient, Database database; try { System.out.println("Waiting for operation to complete..."); - database = operation.get(1600, TimeUnit.SECONDS); + database = operation.get(); } catch (ExecutionException e) { // If the operation failed during execution, expose the cause. throw SpannerExceptionFactory.asSpannerException(e.getCause()); @@ -79,9 +77,6 @@ static Void restoreBackupWithEncryptionKey(DatabaseAdminClient adminClient, // Throw when a thread is waiting, sleeping, or otherwise occupied, // and the thread is interrupted, either before or during the activity. throw SpannerExceptionFactory.propagateInterrupt(e); - } catch (TimeoutException e) { - // If the operation timed out propagates the timeout - throw SpannerExceptionFactory.propagateTimeout(e); } System.out.printf(