r63897 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63896‎ | r63897 | r63898 >
Date:05:23, 18 March 2010
Author:tstarling
Status:ok
Tags:
Comment:
* Fixed complete breakage of "lag.php -r" due to spurious line-endings introduced in maintenance-work.
* Fixed breakage due to lag time cache, based on a hack in the WMF working copy.
* Tested locally.
Modified paths:
  • /trunk/phase3/includes/db/LoadBalancer.php (modified) (history)
  • /trunk/phase3/maintenance/lag.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/LoadBalancer.php
@@ -918,4 +918,11 @@
919919 $this->mLagTimes = $this->getLoadMonitor()->getLagTimes( array_keys( $this->mServers ), $wiki );
920920 return $this->mLagTimes;
921921 }
 922+
 923+ /**
 924+ * Clear the cache for getLagTimes
 925+ */
 926+ function clearLagTimeCache() {
 927+ $this->mLagTimes = null;
 928+ }
922929 }
Index: trunk/phase3/maintenance/lag.php
@@ -18,21 +18,22 @@
1919 public function execute() {
2020 if ( $this->hasOption( 'r' ) ) {
2121 $lb = wfGetLB();
22 - $this->output( 'time ' );
23 - for( $i = 0; $i < $lb->getServerCount(); $i++ ) {
 22+ echo 'time ';
 23+ for( $i = 1; $i < $lb->getServerCount(); $i++ ) {
2424 $hostname = $lb->getServerName( $i );
25 - $this->output( sprintf( "%-12s ", $hostname ) );
 25+ printf( "%-12s ", $hostname );
2626 }
27 - $this->output( "\n" );
 27+ echo "\n";
2828
2929 while( 1 ) {
 30+ $lb->clearLagTimeCache();
3031 $lags = $lb->getLagTimes();
3132 unset( $lags[0] );
32 - $this->output( gmdate( 'H:i:s' ) . ' ' );
 33+ echo gmdate( 'H:i:s' ) . ' ';
3334 foreach( $lags as $i => $lag ) {
34 - $this->output( sprintf( "%-12s " , $lag === false ? 'false' : $lag ) );
 35+ printf( "%-12s " , $lag === false ? 'false' : $lag );
3536 }
36 - $this->output( "\n" );
 37+ echo "\n";
3738 sleep( 5 );
3839 }
3940 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r64049* MFT r63764, r63897, r63898, r63899, r63900, r63901, r63902. Most changes ar...tstarling00:06, 23 March 2010
r64051MFT r63764, r63897, r63898, r63899, r63900, r63901, r63902: assorted working ...tstarling01:21, 23 March 2010

Status & tagging log