Update
This commit is contained in:
parent
d1e385a2a1
commit
1d91792c56
35 changed files with 2275 additions and 237 deletions
23
client_s2/compLib/HealthCheck.py
Normal file
23
client_s2/compLib/HealthCheck.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import threading
|
||||
import time
|
||||
|
||||
import compLib.CompLib_pb2 as CompLib_pb2
|
||||
from compLib.CompLibClient import CompLibClient
|
||||
|
||||
|
||||
class HealthUpdater(object):
|
||||
started = False
|
||||
|
||||
@staticmethod
|
||||
def start():
|
||||
if not HealthUpdater.started:
|
||||
threading.Thread(target=HealthUpdater.loop, daemon=True).start()
|
||||
HealthUpdater.started = True
|
||||
|
||||
@staticmethod
|
||||
def loop():
|
||||
while True:
|
||||
request = CompLib_pb2.HealthUpdateRequest()
|
||||
request.header.message_type = request.DESCRIPTOR.full_name
|
||||
CompLibClient.send(request.SerializeToString(), request.ByteSize())
|
||||
time.sleep(0.25)
|
Reference in a new issue