Browse Source

fix: no integer when http check not health

master
Dnomd343 3 years ago
parent
commit
3641c7a05a
  1. 2
      ProxyChecker/Http.py
  2. 2
      Run.py

2
ProxyChecker/Http.py

@ -79,6 +79,6 @@ def httpCheck(port, url = 'http://gstatic.com/generate_204', timeout = 30):
for ret in result: for ret in result:
if ret > 0: if ret > 0:
sum += ret sum += ret
return False, sum / 2 # 返回成功延迟均值 return False, round(sum / 2, 2) # 返回成功延迟均值
else: # 全部成功 else: # 全部成功
return True, min(min(result[0], result[1]), result[2]) # 返回最低延迟 return True, min(min(result[0], result[1]), result[2]) # 返回最低延迟

2
Run.py

@ -72,11 +72,11 @@ def main(startDelay, httpCheckUrl, httpCheckTimeout):
elif checkResult['success'] == False: elif checkResult['success'] == False:
print("error proxy info") print("error proxy info")
return return
print(checkTag + ' -> ', end = '')
print(checkResult) print(checkResult)
if __setCheckResult(checkTag, checkResult, redisObject, redisPrefix) == False: if __setCheckResult(checkTag, checkResult, redisObject, redisPrefix) == False:
print("redis write error") print("redis write error")
return return
print("ok")
defaultStartDelay = 1.5 defaultStartDelay = 1.5
defaultHttpCheckTimeout = 20 defaultHttpCheckTimeout = 20

Loading…
Cancel
Save