Skip to content

Commit 3f3c13e

Browse files
authored
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
1 parent 37ca990 commit 3f3c13e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

‎samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import com.google.cloud.spanner.encryption.EncryptionConfigs;
3131
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
3232
import java.util.concurrent.ExecutionException;
33-
import java.util.concurrent.TimeUnit;
34-
import java.util.concurrent.TimeoutException;
3533

3634
public class RestoreBackupWithEncryptionKey {
3735

@@ -71,17 +69,14 @@ static Void restoreBackupWithEncryptionKey(DatabaseAdminClient adminClient,
7169
Database database;
7270
try {
7371
System.out.println("Waiting for operation to complete...");
74-
database = operation.get(1600, TimeUnit.SECONDS);
72+
database = operation.get();
7573
} catch (ExecutionException e) {
7674
// If the operation failed during execution, expose the cause.
7775
throw SpannerExceptionFactory.asSpannerException(e.getCause());
7876
} catch (InterruptedException e) {
7977
// Throw when a thread is waiting, sleeping, or otherwise occupied,
8078
// and the thread is interrupted, either before or during the activity.
8179
throw SpannerExceptionFactory.propagateInterrupt(e);
82-
} catch (TimeoutException e) {
83-
// If the operation timed out propagates the timeout
84-
throw SpannerExceptionFactory.propagateTimeout(e);
8580
}
8681

8782
System.out.printf(

0 commit comments

Comments
 (0)