Merge pull request #308 from quietsy/swag-dashboard

Trying to fix long load times
This commit is contained in:
quietsy
2022-01-29 15:45:19 +00:00
committed by GitHub
+6 -4
View File
@@ -32,15 +32,17 @@ def find_apps():
def is_available(url): def is_available(url):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1)
try: try:
host, port = url.split("/")[2].split(":") host, port = url.split("/")[2].split(":")
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: s.connect((host, int(port)))
if sock.connect_ex((host, int(port))) == 0: s.shutdown(socket.SHUT_RDWR)
return True return True
else:
return False
except: except:
return False return False
finally:
s.close()
urllib3.disable_warnings() urllib3.disable_warnings()