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

Function handle_response

tools/rpc_replay/rpc_replay.cpp:117–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117static void handle_response(brpc::Controller* cntl, int64_t start_time,
118 bool sleep_on_error/*note*/) {
119 // TODO(gejun): some bthreads are starved when new bthreads are created
120 // continuously, which happens when server is down and RPC keeps failing.
121 // Sleep a while on error to avoid that now.
122 const int64_t end_time = butil::cpuwide_time_us();
123 const int64_t elp = end_time - start_time;
124 if (!cntl->Failed()) {
125 g_latency_recorder << elp;
126 } else {
127 g_error_count << 1;
128 if (sleep_on_error) {
129 bthread_usleep(10000);
130 }
131 }
132 delete cntl;
133}
134
135butil::atomic<int> g_thread_offset(0);
136

Callers 1

replay_threadFunction · 0.70

Calls 3

cpuwide_time_usFunction · 0.85
bthread_usleepFunction · 0.85
FailedMethod · 0.45

Tested by

no test coverage detected