improvement -> internet checking time

This commit is contained in:
Vinicius Moreira
2021-01-18 14:38:36 -03:00
parent 926ee65105
commit f3ac25fb0f
2 changed files with 4 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Core - Core
- saving settings time (=~ -11%) - saving settings time (=~ -11%)
- internet checking time (=~ -58%)
- UI - UI
- minor improvements - minor improvements

View File

@@ -1,4 +1,4 @@
import http.client as http_client import socket
class InternetChecker: class InternetChecker:
@@ -10,11 +10,9 @@ class InternetChecker:
if self.offline: if self.offline:
return False return False
conn = http_client.HTTPConnection("www.google.com", timeout=5)
try: try:
conn.request("HEAD", "/") socket.gethostbyname('google.com')
conn.close()
return True return True
except: except:
conn.close()
return False return False