| 921 | } |
| 922 | |
| 923 | void Consumer::CheckMaxLoop(const int vpid) { |
| 924 | comm::RetCode ret; |
| 925 | |
| 926 | shared_ptr<const config::TopicConfig> topic_config; |
| 927 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(impl_->topic_id, topic_config))) { |
| 928 | QLErr("GetTopicConfigByTopicID ret %d topic_id %d", comm::as_integer(ret), impl_->topic_id); |
| 929 | return; |
| 930 | } |
| 931 | |
| 932 | static uint32_t nloop = 0; |
| 933 | ++nloop; |
| 934 | |
| 935 | if (0 == nloop % 100) { |
| 936 | QLInfo("nloop %u", nloop); |
| 937 | } |
| 938 | |
| 939 | auto consumer_max_loop_per_proc = topic_config->GetProto().topic().consumer_max_loop_per_proc(); |
| 940 | uint32_t fixed_limit = consumer_max_loop_per_proc + consumer_max_loop_per_proc / 100.0 * (vpid % 20); |
| 941 | if (consumer_max_loop_per_proc && nloop > fixed_limit) { |
| 942 | comm::ConsumerBP::GetThreadInstance()->OnMaxLoopCheckUnpass(impl_->topic_id); |
| 943 | QLInfo("nloop(%u) > fixed_limit(%u), kill it, consumer_max_loop_per_proc %u", nloop, fixed_limit, consumer_max_loop_per_proc); |
| 944 | nloop = 0; |
| 945 | exit(-1); |
| 946 | } |
| 947 | comm::ConsumerBP::GetThreadInstance()->OnMaxLoopCheckPass(impl_->topic_id); |
| 948 | } |
| 949 | |
| 950 | void Consumer::CheckMem(const int vpid) { |
| 951 | comm::RetCode ret; |
nothing calls this directly
no test coverage detected