Updated for naming

This commit is contained in:
Dimitris Zlatanidis 2023-05-19 13:52:07 +03:00
parent b8f544b44f
commit 28ba2e534e
4 changed files with 28 additions and 28 deletions

View file

@ -144,18 +144,18 @@ class CheckUpdates(Configs):
message: str = 'Checking for news, please wait...'
# Starting multiprocessing
p1 = Process(target=self.check_for_updates)
p2 = Process(target=self.progress.progress_bar, args=(message,))
process_1 = Process(target=self.check_for_updates)
process_2 = Process(target=self.progress.progress_bar, args=(message,))
p1.start()
p2.start()
process_1.start()
process_2.start()
# Wait until process 1 finish
p1.join()
process_1.join()
# Terminate process 2 if process 1 finished
if not p1.is_alive():
p2.terminate()
if not process_1.is_alive():
process_2.terminate()
# Restore the terminal cursor
print('\x1b[?25h', self.endc)

View file

@ -36,16 +36,16 @@ class Downloader(Configs):
def download(self) -> None:
""" Starting the processing for downloading. """
process: list = []
processes: list = []
if self.parallel_downloads or self.option_for_parallel:
for url in self.urls:
p1 = Process(target=self.tools, args=(url,))
process.append(p1)
p1.start()
proc = Process(target=self.tools, args=(url,))
processes.append(proc)
proc.start()
for proc in process:
proc.join()
for process in processes:
process.join()
else:
for url in self.urls:
self.tools(url)

View file

@ -34,19 +34,19 @@ class MultiProcess(Configs):
self.stdout = subprocess.DEVNULL
# Starting multiprocessing
p1 = Process(target=self.utils.process, args=(command, self.stderr, self.stdout))
p2 = Process(target=self.progress.progress_bar, args=(progress_message, filename))
process_1 = Process(target=self.utils.process, args=(command, self.stderr, self.stdout))
process_2 = Process(target=self.progress.progress_bar, args=(progress_message, filename))
p1.start()
p2.start()
process_1.start()
process_2.start()
# Wait until process 1 finish
p1.join()
process_1.join()
# Terminate process 2 if process 1 finished
if not p1.is_alive():
p2.terminate()
if p1.exitcode != 0:
if not process_1.is_alive():
process_2.terminate()
if process_1.exitcode != 0:
print(f"\r{'':>2}{self.bred}{self.ascii.bullet}{self.endc} {filename} {failed}{' ' * 17}", end='\r')
else:
print(f"\r{'':>2}{self.bgreen}{self.ascii.bullet}{self.endc} {filename} {done}{' ' * 17}", end='\r')

View file

@ -619,18 +619,18 @@ class UpdateRepository(Configs):
message: str = 'Checking for news, please wait...'
# Starting multiprocessing
p1 = Process(target=self.check_for_updates, args=(queue,))
p2 = Process(target=self.progress.progress_bar, args=(message,))
process_1 = Process(target=self.check_for_updates, args=(queue,))
process_2 = Process(target=self.progress.progress_bar, args=(message,))
p1.start()
p2.start()
process_1.start()
process_2.start()
# Wait until process 1 finish
p1.join()
process_1.join()
# Terminate process 2 if process 1 finished
if not p1.is_alive():
p2.terminate()
if not process_1.is_alive():
process_2.terminate()
# Restore the terminal cursor
print('\x1b[?25h', self.endc, end='')