Avoid wfWaitForSlaves() call when in a transaction in ActiveUsers
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 9 Jul 2014 20:02:22 +0000 (13:02 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 9 Jul 2014 20:02:29 +0000 (13:02 -0700)
* This does not do anything except waste time and connections.
  The query should be small in that case anyway.

Change-Id: I010b3f09be36202ccf408e1a2b084fee0a598ff9

includes/specials/SpecialActiveusers.php

index 8dc4b3c..e25955f 100644 (file)
@@ -410,7 +410,9 @@ class SpecialActiveUsers extends SpecialPage {
                        }
                        foreach ( array_chunk( $newRows, 500 ) as $rowBatch ) {
                                $dbw->insert( 'querycachetwo', $rowBatch, __METHOD__ );
-                               wfWaitForSlaves();
+                               if ( !$dbw->trxLevel() ) {
+                                       wfWaitForSlaves();
+                               }
                        }
                }