subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1387983 - /subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py
Date Thu, 20 Sep 2012 11:44:48 GMT
Author: danielsh
Date: Thu Sep 20 11:44:48 2012
New Revision: 1387983

URL: http://svn.apache.org/viewvc?rev=1387983&view=rev
Log:
* tools/server-side/svnpubsub/svnwcsub.py
  (BackgroundWorker.run): Eliminate one of two race conditions.  Only the
    correctness of the number of threads logged would be affected.

Modified:
    subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py

Modified: subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py?rev=1387983&r1=1387982&r2=1387983&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py (original)
+++ subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py Thu Sep 20 11:44:48 2012
@@ -226,8 +226,11 @@ class BackgroundWorker(threading.Thread)
             operation, wc = self.q.get()
 
             # Warn if the queue is too long.
-            if operation != OP_BOOT and self.q.qsize() > BACKLOG_TOO_HIGH:
-                logging.warn('worker backlog is at %d', self.q.qsize())
+	    # (Note: the other thread might have added entries to self.q
+	    # after the .get() and before the .qsize().)
+	    qsize = self.q.qsize()+1
+            if operation != OP_BOOT and qsize > BACKLOG_TOO_HIGH:
+                logging.warn('worker backlog is at %d', qsize)
 
             try:
                 if operation == OP_UPDATE:



Mime
View raw message