MCPcopy Create free account
hub / github.com/Tencent/CodeAnalysis / _thread_beat

Method _thread_beat

client/node/servertask/nodemgr.py:113–125  ·  view source on GitHub ↗

心跳上报线程

(self)

Source from the content-addressed store, hash-verified

111 self._beat_interval = 8 # sec 心跳上传的频率
112
113 def _thread_beat(self):
114 """
115 心跳上报线程
116 """
117 while True:
118 host_ip = HostNetMgr().get_host_ip()
119 data = {"puppy_ip": host_ip}
120 # LogPrinter.info(f">>> data: {data}")
121 try:
122 self._server.heart_beat(data)
123 except Exception as err:
124 LogPrinter.exception(f"heart beat error: {str(err)}")
125 time.sleep(self._beat_interval)
126
127 def start(self):
128 beat_thread = threading.Thread(target=self._thread_beat)

Callers

nothing calls this directly

Calls 4

HostNetMgrClass · 0.85
get_host_ipMethod · 0.80
heart_beatMethod · 0.80
exceptionMethod · 0.80

Tested by

no test coverage detected