Check for results in concurrent tasks, remove stop_after_first_installed_color flag

This commit is contained in:
Vladyslav Hroshev
2025-04-02 21:37:52 +03:00
parent ef357ee6e2
commit 8a377455ea

View File

@@ -14,7 +14,6 @@ class ThemeInstaller(ABC):
def __init__(self, args: argparse.Namespace, colors: ColorsDefiner): def __init__(self, args: argparse.Namespace, colors: ColorsDefiner):
self.args = args self.args = args
self.colors = colors self.colors = colors
self.stop_after_first_installed_color = False
self._define_theme() self._define_theme()
@abstractmethod @abstractmethod
@@ -84,9 +83,6 @@ class ThemeInstaller(ABC):
sat = values.get('s', args.sat) sat = values.get('s', args.sat)
colors_to_install.append((hue, color, sat)) colors_to_install.append((hue, color, sat))
if self.stop_after_first_installed_color:
break
if not colors_to_install: if not colors_to_install:
return False return False
self._run_concurrent_installation(colors_to_install) self._run_concurrent_installation(colors_to_install)
@@ -96,4 +92,6 @@ class ThemeInstaller(ABC):
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(self._install_theme, hue, color, sat) futures = [executor.submit(self._install_theme, hue, color, sat)
for hue, color, sat in colors_to_install] for hue, color, sat in colors_to_install]
concurrent.futures.wait(futures)
for future in concurrent.futures.as_completed(futures):
future.result()