Skip to content

Commit

Permalink
Fix code review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yihanzhen committed Jun 15, 2018
1 parent df08a8a commit 180ec67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,7 @@ CloseableIterator<PartialResultSet> startStream(@Nullable ByteString resumeToken
: request.toBuilder().setResumeToken(resumeToken).build(),
stream.consumer(),
session.options);
// StreamController does not auto-request 1 message. Kick it off mannually
call.request(1);
if (prefetchChunks > 1) {
call.request(prefetchChunks - 1);
}
call.request(prefetchChunks);
stream.setCall(call);
return stream;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ public GapicSpannerRpc(SpannerOptions options) {
this.projectId = options.getProjectId();
this.projectName = PROJECT_NAME_TEMPLATE.instantiate("project", this.projectId);

// TODO(hzyi): inject userAgent to headerProvider so that it
// can be picked up by ChannelProvider

// create a metadataProvider which combines both internal headers and
// per-method-call extra headers for channelProvider to inject the headers
// for rpc calls
ApiClientHeaderProvider.Builder internalHeaderProviderBuilder =
ApiClientHeaderProvider.newBuilder();
ApiClientHeaderProvider internalHeaderProvider =
Expand Down Expand Up @@ -528,6 +534,9 @@ public SpannerResponseObserver(ResultStreamConsumer consumer) {

@Override
public void onStart(StreamController controller) {

// Disable the auto flow control to allow client library
// set the number of messages it prefers to request
controller.disableAutoInboundFlowControl();
this.controller = controller;
}
Expand Down

0 comments on commit 180ec67

Please sign in to comment.