mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
enhancement: marked several threads as 'daemon' for a faster termination
This commit is contained in:
@@ -1332,7 +1332,7 @@ class ArchManager(SoftwareManager, SettingsController):
|
||||
|
||||
thread_fill_aur = None
|
||||
if aur_replacers:
|
||||
thread_fill_aur = Thread(target=self._fill_aur_providers, args=(aur_replacers, actual_replacers))
|
||||
thread_fill_aur = Thread(target=self._fill_aur_providers, args=(aur_replacers, actual_replacers), daemon=True)
|
||||
thread_fill_aur.start()
|
||||
|
||||
if repo_replacers:
|
||||
@@ -3774,15 +3774,15 @@ class ArchManager(SoftwareManager, SettingsController):
|
||||
|
||||
name_priority = dict()
|
||||
|
||||
fill_suggestions = Thread(target=self._fill_suggestions, args=(name_priority,))
|
||||
fill_suggestions = Thread(target=self._fill_suggestions, args=(name_priority,), daemon=True)
|
||||
fill_suggestions.start()
|
||||
|
||||
available_packages = dict()
|
||||
fill_available = Thread(target=self._fill_available_packages, args=(available_packages,))
|
||||
fill_available = Thread(target=self._fill_available_packages, args=(available_packages,), daemon=True)
|
||||
fill_available.start()
|
||||
|
||||
ignored_pkgs = set()
|
||||
fill_ignored = Thread(target=pacman.fill_ignored_packages, args=(ignored_pkgs,))
|
||||
fill_ignored = Thread(target=pacman.fill_ignored_packages, args=(ignored_pkgs,), daemon=True)
|
||||
fill_ignored.start()
|
||||
|
||||
fill_suggestions.join()
|
||||
@@ -3817,7 +3817,7 @@ class ArchManager(SoftwareManager, SettingsController):
|
||||
|
||||
if filter_installed:
|
||||
ignored_updates = set()
|
||||
thread_fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,))
|
||||
thread_fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,), daemon=True)
|
||||
thread_fill_ignored_updates.start()
|
||||
else:
|
||||
ignored_updates, thread_fill_ignored_updates = None, None
|
||||
@@ -3865,7 +3865,7 @@ class ArchManager(SoftwareManager, SettingsController):
|
||||
update_ignored=pkg_updates_ignored)
|
||||
|
||||
if disk_loader:
|
||||
t = Thread(target=self._fill_cached_if_unset, args=(pkg, disk_loader))
|
||||
t = Thread(target=self._fill_cached_if_unset, args=(pkg, disk_loader), daemon=True)
|
||||
t.start()
|
||||
caching_threads.append(t)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class DependenciesAnalyser:
|
||||
|
||||
if not repository:
|
||||
for name in missing_names:
|
||||
t = Thread(target=self._fill_repository, args=(name, missing_root))
|
||||
t = Thread(target=self._fill_repository, args=(name, missing_root), daemon=True)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
|
||||
@@ -518,7 +518,8 @@ class DependenciesAnalyser:
|
||||
if aur_providers_no_data:
|
||||
aur_providers_data = dict()
|
||||
aur_data_filler = Thread(target=self._fill_aur_updates_data,
|
||||
args=(aur_providers_no_data, aur_providers_data))
|
||||
args=(aur_providers_no_data, aur_providers_data),
|
||||
daemon=True)
|
||||
aur_data_filler.start()
|
||||
|
||||
if repo_providers_no_data:
|
||||
|
||||
@@ -88,7 +88,9 @@ class MultiThreadedDownloader:
|
||||
watcher.print("Could not download '{}' from mirror '{}'".format(pkgname, mirror))
|
||||
else:
|
||||
self.logger.info("Package '{}' successfully downloaded".format(pkg['n']))
|
||||
t = Thread(target=self.download_package_signature, args=(pkg, url, output_path, root_password, watcher), daemon=True)
|
||||
t = Thread(target=self.download_package_signature,
|
||||
args=(pkg, url, output_path, root_password, watcher),
|
||||
daemon=True)
|
||||
t.start()
|
||||
self.async_downloads_lock.acquire()
|
||||
self.async_downloads.append(t)
|
||||
|
||||
@@ -60,7 +60,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
||||
|
||||
def search(self, words: str, disk_loader: Optional[DiskCacheLoader], limit: int, is_url: bool) -> SearchResult:
|
||||
config_ = dict()
|
||||
fill_config = Thread(target=self._fill_config, args=(config_,))
|
||||
fill_config = Thread(target=self._fill_config, args=(config_,), daemon=True)
|
||||
fill_config.start()
|
||||
|
||||
res = SearchResult.empty()
|
||||
@@ -102,11 +102,11 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
||||
names: Optional[Iterable[str]] = None) -> SearchResult:
|
||||
|
||||
config_ = dict()
|
||||
fill_config = Thread(target=self._fill_config, args=(config_,))
|
||||
fill_config = Thread(target=self._fill_config, args=(config_,), daemon=True)
|
||||
fill_config.start()
|
||||
|
||||
ignored_updates = set()
|
||||
fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,))
|
||||
fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,), daemon=True)
|
||||
fill_ignored_updates.start()
|
||||
|
||||
threads = (fill_config, fill_ignored_updates)
|
||||
@@ -170,7 +170,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
||||
if deps:
|
||||
# updates are required to be filled in case the dependencies are currently displayed on the view
|
||||
updates = dict()
|
||||
fill_updates = Thread(target=self._fill_updates, args=(updates,))
|
||||
fill_updates = Thread(target=self._fill_updates, args=(updates,), daemon=True)
|
||||
fill_updates.start()
|
||||
|
||||
deps_data = self.aptitude.show((p.name for p in deps), attrs=('description', 'maintainer', 'section'))
|
||||
@@ -517,7 +517,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
||||
|
||||
def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
|
||||
ignored_updates = set()
|
||||
fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,))
|
||||
fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,), daemon=True)
|
||||
fill_ignored_updates.start()
|
||||
|
||||
updates = list()
|
||||
@@ -551,7 +551,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
||||
|
||||
if filter_installed:
|
||||
installed = set()
|
||||
fill_installed = Thread(target=self._fill_installed_names, args=(installed, ))
|
||||
fill_installed = Thread(target=self._fill_installed_names, args=(installed,), daemon=True)
|
||||
fill_installed.start()
|
||||
else:
|
||||
installed, fill_installed = None, None
|
||||
|
||||
@@ -135,7 +135,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
|
||||
for installation in ('system', 'user'):
|
||||
runtimes = list()
|
||||
output[installation] = runtimes
|
||||
t = Thread(target=self._fill_required_runtimes, args=(installation, runtimes))
|
||||
t = Thread(target=self._fill_required_runtimes, args=(installation, runtimes), daemon=True)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
|
||||
@@ -150,11 +150,13 @@ class FlatpakManager(SoftwareManager, SettingsController):
|
||||
|
||||
thread_updates, thread_runtimes = None, None
|
||||
if internet_available:
|
||||
thread_updates = Thread(target=self._add_updates, args=(version, updates))
|
||||
thread_updates = Thread(target=self._add_updates, args=(version, updates), daemon=True)
|
||||
thread_updates.start()
|
||||
|
||||
if version >= VERSION_1_12:
|
||||
thread_runtimes = Thread(target=self._fill_required_runtime_updates, args=(required_runtimes,))
|
||||
thread_runtimes = Thread(target=self._fill_required_runtime_updates,
|
||||
args=(required_runtimes,),
|
||||
daemon=True)
|
||||
thread_runtimes.start()
|
||||
|
||||
installed = flatpak.list_installed(version)
|
||||
@@ -665,7 +667,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
|
||||
cached_count += 1
|
||||
else:
|
||||
fill = Thread(target=self._fill_suggestion, args=(appid, ids_prios[appid], flatpak_version,
|
||||
remote, res))
|
||||
remote, res), daemon=True)
|
||||
fill.start()
|
||||
fill_suggestions.append(fill)
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ def list_updates_as_str(version: Tuple[str, ...]) -> Dict[str, Set[str]]:
|
||||
|
||||
threads = []
|
||||
for type_, output in (('system', sys_updates), ('user', user_updates)):
|
||||
fill = Thread(target=fill_updates, args=(version, type_, output))
|
||||
fill = Thread(target=fill_updates, args=(version, type_, output), daemon=True)
|
||||
fill.start()
|
||||
threads.append(fill)
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ class SnapManager(SoftwareManager, SettingsController):
|
||||
res.append(cached_sug)
|
||||
cached_count += 1
|
||||
else:
|
||||
t = Thread(target=self._fill_suggestion, args=(name, ids_prios[name], snapd_client, res))
|
||||
t = Thread(target=self._fill_suggestion, args=(name, ids_prios[name], snapd_client, res), daemon=True)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
time.sleep(0.001) # to avoid being blocked
|
||||
|
||||
@@ -258,7 +258,7 @@ class WebApplicationManager(SoftwareManager, SettingsController):
|
||||
|
||||
def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_url: bool = False) -> SearchResult:
|
||||
web_config = {}
|
||||
thread_config = Thread(target=self._fill_config_async, args=(web_config,))
|
||||
thread_config = Thread(target=self._fill_config_async, args=(web_config,), daemon=True)
|
||||
thread_config.start()
|
||||
|
||||
res = SearchResult([], [], 0)
|
||||
@@ -1069,7 +1069,7 @@ class WebApplicationManager(SoftwareManager, SettingsController):
|
||||
|
||||
web_config = {}
|
||||
|
||||
thread_config = Thread(target=self._fill_config_async, args=(web_config,))
|
||||
thread_config = Thread(target=self._fill_config_async, args=(web_config,), daemon=True)
|
||||
thread_config.start()
|
||||
|
||||
if self.suggestions:
|
||||
|
||||
@@ -421,11 +421,13 @@ class EnvironmentUpdater:
|
||||
if system_env:
|
||||
self.logger.warning(f"Using system's nativefier to install {app.url}")
|
||||
else:
|
||||
node_check = Thread(target=self._check_and_fill_node, args=(env, components))
|
||||
node_check = Thread(target=self._check_and_fill_node, args=(env, components), daemon=True)
|
||||
node_check.start()
|
||||
check_threads.append(node_check)
|
||||
|
||||
elec_check = Thread(target=self._check_and_fill_electron, args=(app, env, local_config, is_x86_x64_arch, widevine, components))
|
||||
elec_check = Thread(target=self._check_and_fill_electron,
|
||||
args=(app, env, local_config, is_x86_x64_arch, widevine, components),
|
||||
daemon=True)
|
||||
elec_check.start()
|
||||
check_threads.append(elec_check)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user