You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/09/20 13:44:48 UTC

svn commit: r1387983 - /subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py

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: