From 2d37a7a9b7377931ebaf9fede8e5f3a7d088a150 Mon Sep 17 00:00:00 2001 From: nanahpang <31627465+nanahpang@users.noreply.github.com> Date: Wed, 24 Apr 2019 17:29:24 -0700 Subject: [PATCH] Add alarm in callback streaming test There aren't the right set of alarms in callback streaming reactor, so it exceeds the attempted qps while testing the fixed load streaming scenarios in synthetic benchmarks. --- test/cpp/qps/client_callback.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/cpp/qps/client_callback.cc b/test/cpp/qps/client_callback.cc index 815780e40ff..dcfa2dbf875 100644 --- a/test/cpp/qps/client_callback.cc +++ b/test/cpp/qps/client_callback.cc @@ -285,8 +285,18 @@ class CallbackStreamingPingPongReactor final } return; } - write_time_ = UsageTimer::Now(); - StartWrite(client_->request()); + if (!client_->IsClosedLoop()) { + gpr_timespec next_issue_time = client_->NextRPCIssueTime(); + // Start an alarm callback to run the internal callback after + // next_issue_time + ctx_->alarm_.experimental().Set(next_issue_time, [this](bool ok) { + write_time_ = UsageTimer::Now(); + StartWrite(client_->request()); + }); + } else { + write_time_ = UsageTimer::Now(); + StartWrite(client_->request()); + } } void OnDone(const Status& s) override {