mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 00:44:16 +02:00
fix: application is not initializing when there is no internet connection
This commit is contained in:
@@ -9,7 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- 3 password attempts for root authentication
|
- 3 password attempts for root authentication
|
||||||
- AUR:
|
- AUR:
|
||||||
- showing a "user-friendly" popup when there are integrity issues with the source-files of a building package
|
- showing a "user-friendly" popup when there are integrity issues with the source-files of a building package
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
- application not initializing when there is no internet connection
|
||||||
- AUR:
|
- AUR:
|
||||||
- update-checking for some scenarios
|
- update-checking for some scenarios
|
||||||
- not respecting **ignorepkg** settings in **pacman.conf**
|
- not respecting **ignorepkg** settings in **pacman.conf**
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ from multiprocessing import Process
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from bauh.api.http import HttpClient
|
from bauh.api.http import HttpClient
|
||||||
from bauh.gems.appimage import LOCAL_PATH, db
|
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):
|
def run(self):
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
self._download_databases()
|
self._download_databases()
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
self.logger.warning('The internet connection seems to be off.')
|
||||||
|
|
||||||
self.logger.info('Sleeping')
|
self.logger.info('Sleeping')
|
||||||
time.sleep(self.sleep)
|
time.sleep(self.sleep)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ from multiprocessing import Process
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from bauh.api.abstract.context import ApplicationContext
|
from bauh.api.abstract.context import ApplicationContext
|
||||||
from bauh.api.abstract.controller import SoftwareManager
|
from bauh.api.abstract.controller import SoftwareManager
|
||||||
from bauh.api.constants import HOME_PATH
|
from bauh.api.constants import HOME_PATH
|
||||||
@@ -45,7 +47,7 @@ class AURIndexUpdater(Thread):
|
|||||||
self.logger.info('Pre-indexed {} AUR package names in memory'.format(len(self.man.names_index)))
|
self.logger.info('Pre-indexed {} AUR package names in memory'.format(len(self.man.names_index)))
|
||||||
else:
|
else:
|
||||||
self.logger.warning('No data returned from: {}'.format(URL_INDEX))
|
self.logger.warning('No data returned from: {}'.format(URL_INDEX))
|
||||||
except ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
self.logger.warning('No internet connection: could not pre-index packages')
|
self.logger.warning('No internet connection: could not pre-index packages')
|
||||||
|
|
||||||
time.sleep(60 * 20) # updates every 20 minutes
|
time.sleep(60 * 20) # updates every 20 minutes
|
||||||
@@ -148,6 +150,7 @@ class CategoriesDownloader:
|
|||||||
def get_categories(self) -> Dict[str, List[str]]:
|
def get_categories(self) -> Dict[str, List[str]]:
|
||||||
self.logger.info('Downloading AUR category definitions from {}'.format(self.URL_CATEGORIES_FILE))
|
self.logger.info('Downloading AUR category definitions from {}'.format(self.URL_CATEGORIES_FILE))
|
||||||
|
|
||||||
|
try:
|
||||||
res = self.http_client.get(self.URL_CATEGORIES_FILE)
|
res = self.http_client.get(self.URL_CATEGORIES_FILE)
|
||||||
|
|
||||||
if res:
|
if res:
|
||||||
@@ -166,3 +169,7 @@ class CategoriesDownloader:
|
|||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE))
|
self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE))
|
||||||
|
return {}
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
self.logger.warning('The internet connection seems to be off.')
|
||||||
|
return {}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import traceback
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from bauh.api.abstract.cache import MemoryCache
|
from bauh.api.abstract.cache import MemoryCache
|
||||||
from bauh.api.abstract.context import ApplicationContext
|
from bauh.api.abstract.context import ApplicationContext
|
||||||
from bauh.api.abstract.controller import SoftwareManager
|
from bauh.api.abstract.controller import SoftwareManager
|
||||||
@@ -85,6 +87,7 @@ class CategoriesDownloader:
|
|||||||
def get_categories(self) -> Dict[str, List[str]]:
|
def get_categories(self) -> Dict[str, List[str]]:
|
||||||
self.logger.info('Downloading Snap category definitions from {}'.format(self.URL_CATEGORIES_FILE))
|
self.logger.info('Downloading Snap category definitions from {}'.format(self.URL_CATEGORIES_FILE))
|
||||||
|
|
||||||
|
try:
|
||||||
res = self.http_client.get(self.URL_CATEGORIES_FILE)
|
res = self.http_client.get(self.URL_CATEGORIES_FILE)
|
||||||
|
|
||||||
if res:
|
if res:
|
||||||
@@ -103,3 +106,6 @@ class CategoriesDownloader:
|
|||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE))
|
self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE))
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
self.logger.warning('The internet connection seems to be off.')
|
||||||
|
return {}
|
||||||
|
|||||||
Reference in New Issue
Block a user