fix: application is not initializing when there is no internet connection

This commit is contained in:
Vinicius Moreira
2019-10-22 10:18:35 -03:00
parent a33ede646a
commit 696ce1c79e
4 changed files with 54 additions and 33 deletions

View File

@@ -8,6 +8,8 @@ from multiprocessing import Process
from pathlib import Path
from threading import Thread
import requests
from bauh.api.http import HttpClient
from bauh.gems.appimage import LOCAL_PATH, db
@@ -68,7 +70,11 @@ class DatabaseUpdater(Thread if bool(int(os.getenv('BAUH_DEBUG', 0))) else Proce
def run(self):
if self.enabled:
while True:
self._download_databases()
try:
self._download_databases()
except requests.exceptions.ConnectionError:
self.logger.warning('The internet connection seems to be off.')
self.logger.info('Sleeping')
time.sleep(self.sleep)
else: