Commit 4962beee authored by TousakaRin's avatar TousakaRin

Fix code style

parent e6441cdc
......@@ -95,7 +95,7 @@ void StatusService::default_method(::google::protobuf::RpcController* cntl_base,
<< "_connection_count\" class=\"flot-placeholder\"></div></div>";
}
os << '\n';
const AdaptiveMaxConcurrency max_concurrency =
const AdaptiveMaxConcurrency& max_concurrency =
server->options().max_concurrency;
if (max_concurrency == "constant") {
os << "max_concurrency: " << static_cast<int>(max_concurrency) << '\n';
......
......@@ -184,7 +184,7 @@ void GradientConcurrencyLimiter::UpdateMinLatency(int64_t latency_us) {
void GradientConcurrencyLimiter::UpdateQps(int32_t succ_count,
int64_t sampling_time_us) {
int32_t qps = double(succ_count) / (sampling_time_us - _sw.start_time_us)
double qps = double(succ_count) / (sampling_time_us - _sw.start_time_us)
* 1000 * 1000;
_ema_qps = _ema_qps * _smooth + qps * (1 - _smooth);
}
......
......@@ -875,20 +875,21 @@ int Server::StartInternal(const butil::ip_t& ip,
bthread_setconcurrency(_options.num_threads);
}
if (_options.max_concurrency == "constant" &&
static_cast<int>(_options.max_concurrency) != 0) {
const ConcurrencyLimiter* constant_cl =
ConcurrencyLimiterExtension()->Find("constant");
if (NULL == constant_cl) {
LOG(FATAL) << "Fail to find ConcurrencyLimiter by `constant'";
}
ConcurrencyLimiter* cl_copy = constant_cl->New();
if (NULL == cl_copy) {
LOG(FATAL) << "Fail to new ConcurrencyLimiter";
}
_cl = cl_copy;
_cl->MaxConcurrencyRef() = _options.max_concurrency;
} else if (_options.max_concurrency != "constant") {
if (_options.max_concurrency == "constant") {
if (static_cast<int>(_options.max_concurrency) != 0) {
const ConcurrencyLimiter* constant_cl =
ConcurrencyLimiterExtension()->Find("constant");
if (NULL == constant_cl) {
LOG(FATAL) << "Fail to find ConcurrencyLimiter by `constant'";
}
ConcurrencyLimiter* cl_copy = constant_cl->New();
if (NULL == cl_copy) {
LOG(FATAL) << "Fail to new ConcurrencyLimiter";
}
_cl = cl_copy;
_cl->MaxConcurrencyRef() = _options.max_concurrency;
}
} else {
const ConcurrencyLimiter* cl = NULL;
cl = ConcurrencyLimiterExtension()->Find(
_options.max_concurrency.name().c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment