SF.net SVN: tmda: [2069] trunk/tmda/TMDA/Queue/MaildirQueue.py

[email protected] Thu, 05 Oct 2006 10:42:57 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2069
          http://svn.sourceforge.net/tmda/?rev=2069&view=rev
Author:   jasonrm
Date:     2006-10-05 10:42:55 -0700 (Thu, 05 Oct 2006)

Log Message:
-----------
reduce sleep time between retries from 1s to 0.1s, since as SW points out, 
a new->cur move must be one of (a) an atomic rename() operation or (b) a 
hard-link operation so the file appears in both new and cur, then an unlink 
from new, so if one of the above is the case, then at no time should a message 
not exist in at least one of new/cur, and if we check new first, then cur,
we should be guaranteed to find any message that's there.

Modified Paths:
--------------
    trunk/tmda/TMDA/Queue/MaildirQueue.py

Modified: trunk/tmda/TMDA/Queue/MaildirQueue.py
===================================================================
--- trunk/tmda/TMDA/Queue/MaildirQueue.py	2006-10-05 15:06:56 UTC (rev 2068)
+++ trunk/tmda/TMDA/Queue/MaildirQueue.py	2006-10-05 17:42:55 UTC (rev 2069)
@@ -186,14 +186,14 @@
 		    os.chdir(cwd)
 		    return True
 	    else:
-		# retry several times in case a MUA moved/renamed the
-		# message to cur/
-		time.sleep(1)
+		# retry 5 times in case a MUA moved/renamed the
+		# message to cur/ in a non-atomic way.
+		time.sleep(0.1)
 		msgs = glob.glob('new/[0-9]*.[0-9]*.*') + \
 		    glob.glob('cur/[0-9]*.[0-9]*.*')
 		continue
+	# give up; message is not there
 	os.chdir(cwd)
-	# give up; message is not there
 	return False
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.