Undo 'Fix Maildir race' patch
This was causing OfflineIMAP to hang
This commit is contained in:
parent
393d095ac1
commit
24cdba3221
@ -158,8 +158,7 @@ class MaildirFolder(BaseFolder):
|
|||||||
# Otherwise, save the message in tmp/ and then call savemessageflags()
|
# Otherwise, save the message in tmp/ and then call savemessageflags()
|
||||||
# to give it a permanent home.
|
# to give it a permanent home.
|
||||||
tmpdir = os.path.join(self.getfullname(), 'tmp')
|
tmpdir = os.path.join(self.getfullname(), 'tmp')
|
||||||
file = fd = None
|
messagename = None
|
||||||
messagename = tmpmessaename = None
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
while 1:
|
while 1:
|
||||||
if attempts > 15:
|
if attempts > 15:
|
||||||
@ -172,24 +171,19 @@ class MaildirFolder(BaseFolder):
|
|||||||
socket.gethostname(),
|
socket.gethostname(),
|
||||||
uid,
|
uid,
|
||||||
md5.new(self.getvisiblename()).hexdigest())
|
md5.new(self.getvisiblename()).hexdigest())
|
||||||
tmpmessagename = messagename.split(',')[0]
|
if os.path.exists(os.path.join(tmpdir, messagename)):
|
||||||
try:
|
time.sleep(2)
|
||||||
fd = os.open(os.path.join(tmpdir, tmpmessagename),
|
attempts += 1
|
||||||
os.O_WRONLY + os.O_CREAT + os.O_EXCL)
|
else:
|
||||||
file = os.fdopen(fd, 'w')
|
break
|
||||||
ui.debug('maildir', 'savemessage: using temporary name %s' % tmpmessagename)
|
tmpmessagename = messagename.split(',')[0]
|
||||||
except OSError, e:
|
ui.debug('maildir', 'savemessage: using temporary name %s' % tmpmessagename)
|
||||||
if e.errno == 17:
|
file = open(os.path.join(tmpdir, tmpmessagename), "wt")
|
||||||
time.sleep(2)
|
|
||||||
attempts += 1
|
|
||||||
continue
|
|
||||||
raise
|
|
||||||
|
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
||||||
# Make sure the data hits the disk
|
# Make sure the data hits the disk
|
||||||
file.flush()
|
file.flush()
|
||||||
os.fsync(fd)
|
os.fsync(file.fileno())
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
if rtime != None:
|
if rtime != None:
|
||||||
|
Loading…
Reference in New Issue
Block a user