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

Method RunSync

phxqueue/consumer/hblock.cpp:275–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void 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
307static size_t CalHash(const vector<comm::proto::AddrScale> &addr_scales) {
308 size_t h = crc32(0, Z_NULL, 0);

Callers 1

RunMethod · 0.80

Calls 5

as_integerFunction · 0.85
OnRunSyncMethod · 0.80
OnSyncFailMethod · 0.80
GetTopicIDMethod · 0.45

Tested by

no test coverage detected