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()
|
||||
# to give it a permanent home.
|
||||
tmpdir = os.path.join(self.getfullname(), 'tmp')
|
||||
file = fd = None
|
||||
messagename = tmpmessaename = None
|
||||
messagename = None
|
||||
attempts = 0
|
||||
while 1:
|
||||
if attempts > 15:
|
||||
@ -172,24 +171,19 @@ class MaildirFolder(BaseFolder):
|
||||
socket.gethostname(),
|
||||
uid,
|
||||
md5.new(self.getvisiblename()).hexdigest())
|
||||
tmpmessagename = messagename.split(',')[0]
|
||||
try:
|
||||
fd = os.open(os.path.join(tmpdir, tmpmessagename),
|
||||
os.O_WRONLY + os.O_CREAT + os.O_EXCL)
|
||||
file = os.fdopen(fd, 'w')
|
||||
ui.debug('maildir', 'savemessage: using temporary name %s' % tmpmessagename)
|
||||
except OSError, e:
|
||||
if e.errno == 17:
|
||||
time.sleep(2)
|
||||
attempts += 1
|
||||
continue
|
||||
raise
|
||||
|
||||
if os.path.exists(os.path.join(tmpdir, messagename)):
|
||||
time.sleep(2)
|
||||
attempts += 1
|
||||
else:
|
||||
break
|
||||
tmpmessagename = messagename.split(',')[0]
|
||||
ui.debug('maildir', 'savemessage: using temporary name %s' % tmpmessagename)
|
||||
file = open(os.path.join(tmpdir, tmpmessagename), "wt")
|
||||
file.write(content)
|
||||
|
||||
# Make sure the data hits the disk
|
||||
file.flush()
|
||||
os.fsync(fd)
|
||||
os.fsync(file.fileno())
|
||||
|
||||
file.close()
|
||||
if rtime != None:
|
||||
|
Loading…
Reference in New Issue
Block a user