Give up on proper signal handling

This commit is contained in:
Markus Unterwaditzer 2014-08-23 10:31:06 +02:00
parent ed6d75f1db
commit f6088fd036
2 changed files with 8 additions and 4 deletions

View file

@ -21,7 +21,7 @@ General Section
next sync. The data is needed to determine whether a new item means it has next sync. The data is needed to determine whether a new item means it has
been added on one side or deleted on the other. been added on one side or deleted on the other.
- ``processes``: Optional, defines the amount of maximal connections to use for - ``processes``: Optional, defines the maximal amount of threads to use for
syncing. By default there is no limit, which means vdirsyncer will try to syncing. By default there is no limit, which means vdirsyncer will try to
open a connection for each collection to be synced. The value ``0`` is open a connection for each collection to be synced. The value ``0`` is
ignored. Setting this to ``1`` will only synchronize one collection at a ignored. Setting this to ``1`` will only synchronize one collection at a
@ -32,6 +32,12 @@ General Section
Raspberry Pi is so slow that multiple connections don't help much, since the Raspberry Pi is so slow that multiple connections don't help much, since the
CPU and not the network is the bottleneck. CPU and not the network is the bottleneck.
.. note::
Due to restrictions in Python's threading module, setting ``processes``
to anything else than ``1`` will mean that you can't properly abort the
program with ``^C`` anymore.
.. _pair_config: .. _pair_config:
Pair Section Pair Section

View file

@ -357,9 +357,7 @@ def _create_app():
from multiprocessing.dummy import Pool from multiprocessing.dummy import Pool
p = Pool(processes=general.get('processes', 0) or len(actions)) p = Pool(processes=general.get('processes', 0) or len(actions))
# We have to use map_async.get(large_value) instead of map or rv = p.imap_unordered(_sync_collection, actions)
# map_async.get() because otherwise ^C wouldn't work properly.
rv = p.map_async(_sync_collection, actions).get(10**9)
if not all(rv): if not all(rv):
sys.exit(1) sys.exit(1)