Kaynağa Gözat

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.
nanahpang 6 yıl önce
ebeveyn
işleme
2d37a7a9b7
1 değiştirilmiş dosya ile 12 ekleme ve 2 silme
  1. 12 2
      test/cpp/qps/client_callback.cc

+ 12 - 2
test/cpp/qps/client_callback.cc

@@ -285,8 +285,18 @@ class CallbackStreamingPingPongReactor final
       }
       }
       return;
       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 {
   void OnDone(const Status& s) override {