Skip to content

benchmarks: Avoid sending a message after half close #2376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,13 @@ public void run() {
@Override
public void onNext(Messages.SimpleResponse value) {
delay(System.nanoTime() - now);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: won't now be wrong here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onNext won't be called again. If it is, then an exception will be thrown because onCompleted is called more than once.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I meant on the first time through

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now is initialized to nanoTime(), and the first message is sent outside of the StreamObserver. So it looks like it is consistent.

requestObserver.get().onNext(simpleRequest);
now = System.nanoTime();
if (shutdown) {
requestObserver.get().onCompleted();
// Must not send another request.
return;
}
requestObserver.get().onNext(simpleRequest);
now = System.nanoTime();
}

@Override
Expand Down