Disable old global lock system
Remove the old global locking system. We lock only the accounts that we
currently sync, so you can invoke OfflineImap multiple times now as long
as you sync different accounts. This system is compatible with all
releases >= 6.4.0, so don't run older releases simultanous to this one.
This mostly reverts commit 0d95651417
,
disabling the old global lock system that we had in parallel to the new one.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
5509691dcf
commit
1b85e35256
@ -13,6 +13,12 @@ others.
|
||||
New Features
|
||||
------------
|
||||
|
||||
* Remove the old global locking system. We lock only the accounts that
|
||||
we currently sync, so you can invoke OfflineImap multiple times now as
|
||||
long as you sync different accounts. This system is compatible with
|
||||
all releases >= 6.4.0, so don't run older releases simultanous to this
|
||||
one.
|
||||
|
||||
Changes
|
||||
-------
|
||||
|
||||
|
@ -191,7 +191,6 @@ class SyncableAccount(Account):
|
||||
|
||||
def lock(self):
|
||||
"""Lock the account, throwing an exception if it is locked already"""
|
||||
# Take a new-style per-account lock
|
||||
self._lockfd = open(self._lockfilepath, 'w')
|
||||
try:
|
||||
fcntl.lockf(self._lockfd, fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
|
@ -23,10 +23,6 @@ import signal
|
||||
import socket
|
||||
import logging
|
||||
from optparse import OptionParser
|
||||
try:
|
||||
import fcntl
|
||||
except ImportError:
|
||||
pass #it's OK
|
||||
import offlineimap
|
||||
from offlineimap import accounts, threadutil, syncmaster
|
||||
from offlineimap.error import OfflineImapError
|
||||
@ -340,18 +336,6 @@ class OfflineImap:
|
||||
#various initializations that need to be performed:
|
||||
offlineimap.mbnames.init(self.config, syncaccounts)
|
||||
|
||||
#TODO: keep legacy lock for a few versions, then remove.
|
||||
self._legacy_lock = open(self.config.getmetadatadir() + "/lock",
|
||||
'w')
|
||||
try:
|
||||
fcntl.lockf(self._legacy_lock, fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
except NameError:
|
||||
#fcntl not available (Windows), disable file locking... :(
|
||||
pass
|
||||
except IOError:
|
||||
raise OfflineImapError("Could not take global lock.",
|
||||
OfflineImapError.ERROR.REPO)
|
||||
|
||||
if options.singlethreading:
|
||||
#singlethreaded
|
||||
self.sync_singlethreaded(syncaccounts)
|
||||
|
Loading…
Reference in New Issue
Block a user