Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Dec 2, 2024
1 parent 793d4da commit 4859af0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,6 @@
grpc-auth is not directly used transitively, but is pulled to align with other grpc parts
opencensus-impl-core is brought in transitively through opencensus-impl
-->
<usedDependencies>io.grpc:grpc-auth</usedDependencies>
<ignoredUsedUndeclaredDependencies>
<ignoredUsedUndeclaredDependency>io.opencensus:opencensus-impl-core</ignoredUsedUndeclaredDependency>
</ignoredUsedUndeclaredDependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.common.net.PercentEscaper;
import io.grpc.CallCredentials;
import io.grpc.ClientCall;
import io.grpc.Deadline;
import io.grpc.ManagedChannel;
import io.grpc.Metadata;
import io.grpc.Status;
Expand Down Expand Up @@ -80,11 +81,11 @@ static BigtableChannelPrimer create(EnhancedBigtableStubSettings settings) throw
.getHeaders()
.forEach((k, v) -> metadata.put(Metadata.Key.of(k, Metadata.ASCII_STRING_MARSHALLER), v));

String escapedName = escaper.escape(request.getName());
String escapedAppProfile = escaper.escape(request.getAppProfileId());
metadata.put(
requestParams,
escaper.escape(
String.format(
"name=%s&app_profile_id=%s", request.getName(), request.getAppProfileId())));
escaper.escape(String.format("name=%s&app_profile_id=%s", escapedName, escapedAppProfile)));
}

@Override
Expand All @@ -106,7 +107,10 @@ private void sendPrimeRequests(ManagedChannel managedChannel) {
ClientCall<PingAndWarmRequest, PingAndWarmResponse> clientCall =
managedChannel.newCall(
BigtableGrpc.getPingAndWarmMethod(),
GrpcCallContext.createDefault().getCallOptions().withCallCredentials(credentials));
GrpcCallContext.createDefault()
.getCallOptions()
.withCallCredentials(credentials)
.withDeadline(Deadline.after(1, TimeUnit.MINUTES)));

SettableApiFuture<PingAndWarmResponse> future = SettableApiFuture.create();
clientCall.start(
Expand All @@ -130,7 +134,7 @@ public void onClose(Status status, Metadata trailers) {
metadata);
clientCall.sendMessage(request);
clientCall.halfClose();
clientCall.request(1);
clientCall.request(Integer.MAX_VALUE);

future.get(1, TimeUnit.MINUTES);
} catch (Throwable e) {
Expand Down

0 comments on commit 4859af0

Please sign in to comment.