MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Judge

Method Judge

phxqueue/consumer/freqman.cpp:420–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void FreqMan::Judge(const int vpid, bool &need_block, bool &need_freqlimit,
421 int &nrefill, int &refill_interval_ms) {
422 need_block = need_freqlimit = false;
423 nrefill = refill_interval_ms = 0;
424
425 if (vpid > MAX_VPID) {
426 QLErr("vpid(%d) > MAX_VPID(%d)", vpid, MAX_VPID);
427 return;
428 }
429 auto &&limit_info = impl_->shm->limit_infos[vpid];
430 auto &&consume_stat = impl_->shm->consume_stats[vpid];
431
432 int nhandle_limit = limit_info.nhandle_limit;
433 int nhandle_tot = consume_stat.nhandle_tot;
434
435 if (!nhandle_limit) return;
436
437 need_freqlimit = true;
438 nrefill = limit_info.nrefill;
439 refill_interval_ms = limit_info.refill_interval_ms;
440
441 if (nhandle_tot > nhandle_limit) {
442 need_block = true;
443 return;
444 }
445}
446
447
448} // namespace consumer

Callers 1

ProcessMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected