Skip to content
Permalink
Browse files
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
  • Loading branch information
olavloite committed Apr 29, 2021
1 parent 37ca990 commit 3f3c13e7fcbf08b8ab6f0d11d7451b3ae86c9500
Showing with 1 addition and 6 deletions.
  1. +1 −6 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,17 +69,14 @@ 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());
} catch (InterruptedException e) {
// 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(

0 comments on commit 3f3c13e

Please sign in to comment.