| 319 | } |
| 320 | |
| 321 | comm::RetCode HeartBeatLock::GetAddrScale(SubID2AddrScales &sub_id2addr_scales) { |
| 322 | QLVerb("start"); |
| 323 | |
| 324 | sub_id2addr_scales.clear(); |
| 325 | |
| 326 | auto &&opt = impl_->consumer->GetConsumerOption(); |
| 327 | |
| 328 | AddrScales config_addr_scales, dynamic_addr_scales; |
| 329 | |
| 330 | comm::RetCode ret; |
| 331 | |
| 332 | auto topic_id = impl_->consumer->GetTopicID(); |
| 333 | |
| 334 | shared_ptr<const config::ConsumerConfig> consumer_config; |
| 335 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetConsumerConfig(topic_id, consumer_config))) { |
| 336 | QLErr("GetConsumerConfig ret %d", comm::as_integer(ret)); |
| 337 | return ret; |
| 338 | } |
| 339 | |
| 340 | std::set<int> sub_ids; |
| 341 | { |
| 342 | comm::proto::Addr addr; |
| 343 | addr.set_ip(opt->ip); |
| 344 | addr.set_port(opt->port); |
| 345 | |
| 346 | if (comm::RetCode::RET_OK != (ret = config::utils::GetSubIDsByConsumerAddr(topic_id, addr, sub_ids))) { |
| 347 | QLErr("GetSubIDs ret %d", comm::as_integer(ret)); |
| 348 | return ret; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | shared_ptr<const config::TopicConfig> topic_config; |
| 353 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 354 | QLErr("ERR: GetTopicConfigByTopicID ret %d", comm::as_integer(ret)); |
| 355 | return ret; |
| 356 | } |
| 357 | |
| 358 | std::set<int> dynamic_sub_ids; |
| 359 | for (auto &&sub_id : sub_ids) { |
| 360 | shared_ptr<const config::proto::Sub> sub; |
| 361 | if (comm::RetCode::RET_OK != (ret = topic_config->GetSubBySubID(sub_id, sub))) { |
| 362 | QLErr("GetSubBySubID ret %d", comm::as_integer(ret)); |
| 363 | continue; |
| 364 | } |
| 365 | if (sub->use_dynamic_scale()) { |
| 366 | dynamic_sub_ids.insert(sub_id); |
| 367 | } |
| 368 | } |
| 369 | QLVerb("dynamic sub_ids size %d", dynamic_sub_ids.size()); |
| 370 | |
| 371 | |
| 372 | if (dynamic_sub_ids.size()) { |
| 373 | comm::proto::GetAddrScaleRequest req; |
| 374 | comm::proto::GetAddrScaleResponse resp; |
| 375 | req.set_topic_id(topic_id); |
| 376 | auto &&addr = req.mutable_addr(); |
| 377 | addr->set_ip(opt->ip); |
| 378 | addr->set_port(opt->port); |
nothing calls this directly
no test coverage detected