From d237ac849ced6fb52430f8f7a83e55dd1a6039ac Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 28 Jan 2021 20:03:42 -0600 Subject: [PATCH] Plugin: Only run one BG download at time. --- calibre-plugin/fff_plugin.py | 3 +-- calibre-plugin/jobs.py | 11 +++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/calibre-plugin/fff_plugin.py b/calibre-plugin/fff_plugin.py index c4a4292d..3a5d4510 100644 --- a/calibre-plugin/fff_plugin.py +++ b/calibre-plugin/fff_plugin.py @@ -1706,9 +1706,8 @@ class FanFicFarePlugin(InterfaceAction): options['plugin_path'] = self.interface_action_base_plugin.plugin_path func = 'arbitrary_n' - cpus = self.gui.job_manager.server.pool_size args = ['calibre_plugins.fanficfare_plugin.jobs', 'do_download_worker', - (book_list, options, cpus, merge)] + (book_list, options, merge)] desc = _('Download %s FanFiction Book(s)') % sum(1 for x in book_list if x['good']) job = self.gui.job_manager.run_job( self.Dispatcher(partial(self.download_list_completed,options=options,merge=merge)), diff --git a/calibre-plugin/jobs.py b/calibre-plugin/jobs.py index d9725524..f54a5bab 100644 --- a/calibre-plugin/jobs.py +++ b/calibre-plugin/jobs.py @@ -38,16 +38,19 @@ except NameError: def do_download_worker(book_list, options, - cpus, merge=False, notification=lambda x,y:x): ''' - Coordinator job, to launch child jobs to extract ISBN for a set of books + Coordinator job, to launch child jobs to do downloads. This is run as a worker job in the background to keep the UI more - responsive and get around the memory leak issues as it will launch + responsive and get around any memory leak issues as it will launch a child job for each book as a worker process ''' - server = Server(pool_size=cpus) + ## pool_size reduced to 1 to prevent parallel downloads on the + ## same site. Also prevents parallel downloads on different + ## sites. Might do something different to allow that again + ## someday. + server = Server(pool_size=1) logger.info(options['version']) total = 0