File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ private synchronized void shutdown() {
168168
"com.google.cloud.spanner.watchdogPeriodSeconds";
169169
private static final int DEFAULT_TIMEOUT_SECONDS = 30 * 60;
170170
private static final int DEFAULT_PERIOD_SECONDS = 10;
171+
private static final int GRPC_KEEPALIVE_SECONDS = 2 * 60;
171172

172173
private final ManagedInstantiatingExecutorProvider executorProvider;
173174
private boolean rpcIsClosed;
@@ -242,6 +243,10 @@ public GapicSpannerRpc(final SpannerOptions options) {
242243
.setPoolSize(options.getNumChannels())
243244
.setExecutorProvider(executorProvider)
244245

246+
// Set a keepalive time of 120 seconds to help long running
247+
// commit GRPC calls succeed
248+
.setKeepAliveTime(Duration.ofSeconds(GRPC_KEEPALIVE_SECONDS))
249+
245250
// Then check if SpannerOptions provides an InterceptorProvider. Create a default
246251
// SpannerInterceptorProvider if none is provided
247252
.setInterceptorProvider(

0 commit comments

Comments
 (0)