Skip to content

Commit 293a074

Browse files
committed
fix(spanner): preserve call options when applying statement timeout
1 parent 4614cae commit 293a074

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractBaseUnitOfWork.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,11 @@ public <ReqT, RespT> ApiCallContext configure(
388388
if (remainingTimeout <= 0) {
389389
remainingTimeout = 1;
390390
}
391-
return GrpcCallContext.createDefault()
391+
// Build from the input context so existing call options
392+
// (e.g. grpc-gcp's AFFINITY_KEY set by GapicSpannerRpc.newCallContext)
393+
// survive the GrpcCallContext.merge() — merge rebuilds CallOptions from
394+
// the configurator result, dropping any options it does not carry.
395+
return ((GrpcCallContext) context)
392396
.withTimeoutDuration(Duration.ofNanos(remainingTimeout));
393397
}
394398
return null;

0 commit comments

Comments
 (0)