Attempt to terminate threads when pyfa is closed

This commit is contained in:
DarkPhoenix
2020-02-03 17:12:23 +03:00
parent 9ddfcc894f
commit 6527f9e11e
7 changed files with 99 additions and 18 deletions

View File

@@ -41,6 +41,7 @@ class CheckUpdateThread(threading.Thread):
self.callback = callback
self.settings = UpdateSettings.getInstance()
self.network = Network.getInstance()
self.running = True
def run(self):
network = Network.getInstance()
@@ -49,13 +50,13 @@ class CheckUpdateThread(threading.Thread):
try:
response = network.get(
url='https://www.pyfa.io/update_check?pyfa_version={}&client_hash={}'.format(config.version, config.getClientSecret()),
type=network.UPDATE)
type=network.UPDATE, timeout=5)
except (KeyboardInterrupt, SystemExit):
raise
except Exception as e:
response = network.get(
url='https://api.github.com/repos/pyfa-org/Pyfa/releases',
type=network.UPDATE)
type=network.UPDATE, timeout=5)
jsonResponse = response.json()
jsonResponse.sort(
@@ -94,6 +95,9 @@ class CheckUpdateThread(threading.Thread):
def versiontuple(v):
return tuple(map(int, (v.split("."))))
def stop(self):
self.running = False
class Update:
instance = None