mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-15 13:22:23 +01:00
Plugin: Only run one BG download at time.
This commit is contained in:
parent
5922d027b7
commit
20b5b8fb95
2 changed files with 8 additions and 6 deletions
|
|
@ -1700,9 +1700,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)),
|
||||
|
|
|
|||
|
|
@ -39,16 +39,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue