mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Don't use multiprocessing when having one process
This commit is contained in:
parent
f8c2c8f879
commit
6c81fd6fc2
1 changed files with 13 additions and 3 deletions
|
|
@ -201,9 +201,19 @@ def _main(env, file_cfg):
|
|||
'general': general
|
||||
})
|
||||
|
||||
from multiprocessing import Pool
|
||||
p = Pool(processes=general.get('processes', 0) or len(actions))
|
||||
p.map(_sync_collection, actions)
|
||||
processes = general.get('processes', 0) or len(actions)
|
||||
cli_logger.debug('Using {} processes.'.format(processes))
|
||||
|
||||
if processes == 1:
|
||||
cli_logger.debug('Not using multiprocessing.')
|
||||
_map = map
|
||||
else:
|
||||
cli_logger.debug('Using multiprocessing.')
|
||||
from multiprocessing import Pool
|
||||
p = Pool(processes=general.get('processes', 0) or len(actions))
|
||||
_map = p.map
|
||||
|
||||
_map(_sync_collection, actions)
|
||||
|
||||
app.register_command('sync', sync_command)
|
||||
app()
|
||||
|
|
|
|||
Loading…
Reference in a new issue