89619838b0
The SigListener class was used to queue folders that we need to sync and to receive "resync" and "abort" signals. It was undocumented and weird and we had to pass "siglisteners" through the whole program. Simply do away with it, and make 2 functions in the Account() class: set_abort_event and get_abort_event which can be used to set and check for such signals. This way we do not need to pass siglisteners all over the place. Tested Blinkenlights and TTYUI uis to make sure that SIGUSR1 and SIGUSR2 actually still work. Document those signals in MANUAL.rst. They were completly undocumented. This simplifies the code and interdependencies by passing less stuff around. Removes an undocumented and weirdly named class. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
# OfflineIMAP synchronization master code
|
|
# Copyright (C) 2002-2007 John Goerzen
|
|
# <jgoerzen@complete.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
from offlineimap.threadutil import threadlist, InstanceLimitedThread
|
|
from offlineimap.accounts import SyncableAccount
|
|
from threading import currentThread
|
|
|
|
def syncaccount(threads, config, accountname):
|
|
account = SyncableAccount(config, accountname)
|
|
thread = InstanceLimitedThread(instancename = 'ACCOUNTLIMIT',
|
|
target = account.syncrunner,
|
|
name = "Account sync %s" % accountname)
|
|
thread.setDaemon(1)
|
|
thread.start()
|
|
threads.add(thread)
|
|
|
|
def syncitall(accounts, config):
|
|
currentThread().setExitMessage('SYNC_WITH_TIMER_TERMINATE')
|
|
threads = threadlist()
|
|
for accountname in accounts:
|
|
syncaccount(threads, config, accountname)
|
|
# Wait for the threads to finish.
|
|
threads.reset()
|