MCPcopy Create free account
hub / github.com/baidu/tera / DequeueRpc

Method DequeueRpc

src/tabletnode/rpc_schedule.cc:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39bool RpcSchedule::DequeueRpc(RpcTask** rpc) {
40 MutexLock lock(&mutex_);
41 if (pending_task_count_ == 0) {
42 return false;
43 }
44
45 TableList::iterator it = policy_->Pick(&table_list_);
46 CHECK(it != table_list_.end());
47
48 ScheduleEntity* entity = (ScheduleEntity*)it->second;
49 TaskQueue* task_queue = (TaskQueue*)entity->user_ptr;
50 CHECK_GT(task_queue->size(), 0U);
51
52 *rpc = task_queue->front();
53 task_queue->pop();
54
55 task_queue->pending_count--;
56 task_queue->running_count++;
57 pending_task_count_--;
58 running_task_count_++;
59
60 if (task_queue->pending_count == 0) {
61 policy_->Disable(entity);
62 }
63 return true;
64}
65
66bool RpcSchedule::FinishRpc(const std::string& table_name) {
67 MutexLock lock(&mutex_);

Callers 2

DoScheduleRpcMethod · 0.80

Calls 3

PickMethod · 0.80
DisableMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected