心跳上报线程
(self)
| 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) |
nothing calls this directly
no test coverage detected