| 587 | } |
| 588 | |
| 589 | Mode SchedulerMgr::GetMode(const int topic_id, TopicData &topic_data, const uint64_t now) { |
| 590 | Mode mode{Mode::Dynamic}; |
| 591 | std::shared_ptr<const config::TopicConfig> topic_config; |
| 592 | comm::RetCode ret{config::GlobalConfig::GetThreadInstance()-> |
| 593 | GetTopicConfigByTopicID(topic_id, topic_config)}; |
| 594 | if (comm::RetCode::RET_OK != ret) { |
| 595 | QLErr("GetTopicConfigByTopicID err %d", ret); |
| 596 | |
| 597 | return Mode::Static; |
| 598 | } |
| 599 | |
| 600 | if (topic_data.init_time + |
| 601 | 3 * topic_config->GetProto().topic().scheduler_get_scale_interval_s() * 1000 >= now) { |
| 602 | // stay a long time for most consumer GetAddrScale() |
| 603 | QLInfo("Mode::Dynamic not ready"); |
| 604 | mode = Mode::Static; |
| 605 | } |
| 606 | |
| 607 | return mode; |
| 608 | } |
| 609 | |
| 610 | comm::RetCode SchedulerMgr::GetMeanLoad(const int topic_id, const TopicData &topic_data, |
| 611 | float &mean_load) { |
nothing calls this directly
no test coverage detected