Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/115522

Change subject: Avoid showing crazy staleness times at ActiveUsers
......................................................................

Avoid showing crazy staleness times at ActiveUsers

* Also do the query more aggressively on small wikis

Change-Id: I089b2f69d03bb289035be11ccfe4937931904d25
---
M includes/specials/SpecialActiveusers.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/22/115522/1

diff --git a/includes/specials/SpecialActiveusers.php 
b/includes/specials/SpecialActiveusers.php
index 641c046..9fd1579 100644
--- a/includes/specials/SpecialActiveusers.php
+++ b/includes/specials/SpecialActiveusers.php
@@ -242,7 +242,7 @@
                        array( 'activeusers-intro', 
$this->getLanguage()->formatNum( $wgActiveUserDays ) ) );
 
                // Occasionally merge in new updates
-               $seconds = self::mergeActiveUsers( 600 );
+               $seconds = min( self::mergeActiveUsers( 600 ), 
$wgActiveUserDays * 86400 );
                // Mention the level of staleness
                $out->addWikiMsg( 'cachedspecial-viewing-cached-ttl',
                        $this->getLanguage()->formatDuration( $seconds ) );
@@ -270,7 +270,7 @@
 
        /**
         * @param integer $period Seconds (do updates no more often than this)
-        * @return integer How many seconds old the cache is
+        * @return integer How many seconds old the cache is (0 if no cache 
exists)
         */
        public static function mergeActiveUsers( $period ) {
                global $wgActiveUserDays;
@@ -283,7 +283,12 @@
                if ( !wfReadOnly() ) {
                        if ( !$cTime || ( time() - wfTimestamp( TS_UNIX, $cTime 
) ) > $period ) {
                                $dbw = wfGetDB( DB_MASTER );
-                               self::doQueryCacheUpdate( $dbw, 2 * $period );
+                               if ( $dbw->estimateRowCount( 'recentchanges' ) 
<= 10000 ) {
+                                       $window = $wgActiveUserDays * 86400; // 
small wiki
+                               } else {
+                                       $window = $period * 2;
+                               }
+                               self::doQueryCacheUpdate( $dbw, $window );
                        }
                }
                return ( time() -

-- 
To view, visit https://gerrit.wikimedia.org/r/115522
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I089b2f69d03bb289035be11ccfe4937931904d25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to