MCPcopy Create free account
hub / github.com/apache/brpc / feed_back_thread

Method feed_back_thread

test/brpc_circuit_breaker_unittest.cpp:103–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 virtual void TearDown() {};
102
103 static void* feed_back_thread(void* data) {
104 FeedbackControl* fc = static_cast<FeedbackControl*>(data);
105 for (int i = 0; i < fc->_req_num; ++i) {
106 bool healthy = false;
107 if (rand() % 100 < fc->_error_percent) {
108 healthy = fc->_circuit_breaker->OnCallEnd(kErrorCodeForFailed, kErrorCost);
109 } else {
110 healthy = fc->_circuit_breaker->OnCallEnd(kErrorCodeForSucc, kLatency);
111 }
112 fc->_healthy = healthy;
113 if (healthy) {
114 ++fc->_healthy_cnt;
115 } else {
116 ++fc->_unhealthy_cnt;
117 }
118 }
119 return fc;
120 }
121
122 void StartFeedbackThread(std::vector<pthread_t>* thread_list,
123 std::vector<std::unique_ptr<FeedbackControl>>* fc_list,

Callers

nothing calls this directly

Calls 1

OnCallEndMethod · 0.80

Tested by

no test coverage detected