| 273 | } |
| 274 | |
| 275 | void HeartBeatLock::RunSync() { |
| 276 | comm::RetCode ret; |
| 277 | pid_t pid = fork(); |
| 278 | if (pid == 0) { |
| 279 | |
| 280 | prctl(PR_SET_PDEATHSIG, SIGHUP); |
| 281 | |
| 282 | impl_->consumer->OnRunSync(); |
| 283 | |
| 284 | //oss_call_stat_attach(vpid); |
| 285 | //mmlb_stat_attach(vpid); |
| 286 | |
| 287 | const int topic_id = impl_->consumer->GetTopicID(); |
| 288 | |
| 289 | while (true) { |
| 290 | if (0 > comm::as_integer(ret = Sync())) { |
| 291 | QLErr("ERR: Sync fail. ret %d", comm::as_integer(ret)); |
| 292 | comm::ConsumerHeartBeatLockBP::GetThreadInstance()->OnSyncFail(topic_id); |
| 293 | } |
| 294 | |
| 295 | shared_ptr<const config::TopicConfig> topic_config; |
| 296 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 297 | QLErr("ERR: GetTopicConfigByTopicID ret %d topic_id %u", ret, topic_id); |
| 298 | continue; |
| 299 | } |
| 300 | |
| 301 | sleep(topic_config->GetProto().topic().scheduler_get_scale_interval_s()); |
| 302 | } |
| 303 | exit(0); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | static size_t CalHash(const vector<comm::proto::AddrScale> &addr_scales) { |
| 308 | size_t h = crc32(0, Z_NULL, 0); |
no test coverage detected