in platform/consensus/ordering/pbft/response_manager.cpp [251:291]
int ResponseManager::BatchProposeMsg() {
LOG(INFO) << "batch wait time:" << config_.ClientBatchWaitTimeMS()
<< " batch num:" << config_.ClientBatchNum();
std::vector<std::unique_ptr<QueueItem>> batch_req;
while (!stop_) {
if (send_num_ > config_.GetMaxProcessTxn()) {
LOG(ERROR) << "send num too high, wait:" << send_num_;
usleep(100);
continue;
}
if (batch_req.size() < config_.ClientBatchNum()) {
std::unique_ptr<QueueItem> item =
batch_queue_.Pop(config_.ClientBatchWaitTimeMS());
if (item != nullptr) {
batch_req.push_back(std::move(item));
if (batch_req.size() < config_.ClientBatchNum()) {
continue;
}
}
}
if (batch_req.empty()) {
continue;
}
int ret = DoBatch(batch_req);
batch_req.clear();
if (ret != 0) {
Response response;
response.set_result(Response::ERROR);
for (size_t i = 0; i < batch_req.size(); ++i) {
if (batch_req[i]->context && batch_req[i]->context->client) {
int ret = batch_req[i]->context->client->SendRawMessage(response);
if (ret) {
LOG(ERROR) << "send resp" << response.DebugString()
<< " fail ret:" << ret;
}
}
}
}
}
return 0;
}