mirror of
https://github.com/yshtcn/heartbeat.git
synced 2025-12-14 10:10:26 +08:00
Update heartbeat.py
当ping为0时,将其设为1
This commit is contained in:
parent
f3652294ac
commit
25bdf4b764
@ -76,12 +76,16 @@ def ping(host):
|
||||
ping_result = ''.join(filter(str.isdigit, time_str))
|
||||
|
||||
if ping_result.isdigit() and int(ping_result) < 10000:
|
||||
# If ping result is 0, change it to 1
|
||||
if int(ping_result) == 0:
|
||||
ping_result = '1'
|
||||
return ping_result
|
||||
|
||||
logger.info(f"{datetime.now()} Ping command output: {repr(stdout)}")
|
||||
return "ping failed"
|
||||
|
||||
|
||||
|
||||
def heartbeat(interval, heartbeat_url, session, ping_host):
|
||||
while not stop_heartbeat.is_set():
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user