mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-18 16:58:27 -04:00
Trying to fix long loads
This commit is contained in:
@@ -32,15 +32,17 @@ def find_apps():
|
|||||||
|
|
||||||
|
|
||||||
def is_available(url):
|
def is_available(url):
|
||||||
|
host, port = url.split("/")[2].split(":")
|
||||||
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
s.settimeout(1)
|
||||||
try:
|
try:
|
||||||
host, port = url.split("/")[2].split(":")
|
s.connect((host, int(port)))
|
||||||
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
s.shutdown(socket.SHUT_RDWR)
|
||||||
if sock.connect_ex((host, int(port))) == 0:
|
return True
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
finally:
|
||||||
|
s.close()
|
||||||
|
|
||||||
|
|
||||||
urllib3.disable_warnings()
|
urllib3.disable_warnings()
|
||||||
|
|||||||
Reference in New Issue
Block a user