Skip to content

Commit

Permalink
docs: use default timeout for restore operation (#1109)
Browse files Browse the repository at this point in the history
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 3f3c13e
Showing 1 changed file with 1 addition and 6 deletions.
Expand Up @@ -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 {

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 3f3c13e

Please sign in to comment.