From: Oleg Broytman Date: Mon, 9 Sep 2024 20:07:24 +0000 (+0300) Subject: Refactor(Robots): Split `robot_multirequests` into `cf_multiprocess` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=817259d300eda1bcfa98ddc307ca42e07d86c505;p=bookmarks_db.git Refactor(Robots): Split `robot_multirequests` into `cf_multiprocess` --- diff --git a/Robots/bkmk_rmultirequests.py b/Robots/bkmk_rmultirequests.py index 39daf9c..3a52b44 100644 --- a/Robots/bkmk_rmultirequests.py +++ b/Robots/bkmk_rmultirequests.py @@ -12,17 +12,11 @@ __license__ = "GNU GPL" __all__ = ['robot_multirequests'] -import concurrent.futures - -from Robots.concurrent_futures import concurrent_futures +from Robots.concurrent_futures import cf_multiprocess from robots import import_robot, set_params, robot_params -class robot_multirequests(concurrent_futures): - def __init__(self, *args, **kw): - self.concurrent_class = concurrent.futures.ProcessPoolExecutor - concurrent_futures.__init__(self, *args, **kw) - +class robot_multirequests(cf_multiprocess): def check_bkmk_task(self): return check_bookmark_subproc diff --git a/Robots/concurrent_futures.py b/Robots/concurrent_futures.py index 7e4a165..11dd034 100644 --- a/Robots/concurrent_futures.py +++ b/Robots/concurrent_futures.py @@ -77,3 +77,9 @@ class concurrent_futures(multi_mixin, robot_base): def stop(self): super(concurrent_futures, self).stop() self.executor.shutdown(wait=True) + + +class cf_multiprocess(concurrent_futures): + def __init__(self, *args, **kw): + self.concurrent_class = concurrent.futures.ProcessPoolExecutor + concurrent_futures.__init__(self, *args, **kw)