Index: trunk/phase3/includes/db/LoadBalancer.php |
— | — | @@ -918,4 +918,11 @@ |
919 | 919 | $this->mLagTimes = $this->getLoadMonitor()->getLagTimes( array_keys( $this->mServers ), $wiki ); |
920 | 920 | return $this->mLagTimes; |
921 | 921 | } |
| 922 | + |
| 923 | + /** |
| 924 | + * Clear the cache for getLagTimes |
| 925 | + */ |
| 926 | + function clearLagTimeCache() { |
| 927 | + $this->mLagTimes = null; |
| 928 | + } |
922 | 929 | } |
Index: trunk/phase3/maintenance/lag.php |
— | — | @@ -18,21 +18,22 @@ |
19 | 19 | public function execute() { |
20 | 20 | if ( $this->hasOption( 'r' ) ) { |
21 | 21 | $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++ ) { |
24 | 24 | $hostname = $lb->getServerName( $i ); |
25 | | - $this->output( sprintf( "%-12s ", $hostname ) ); |
| 25 | + printf( "%-12s ", $hostname ); |
26 | 26 | } |
27 | | - $this->output( "\n" ); |
| 27 | + echo "\n"; |
28 | 28 | |
29 | 29 | while( 1 ) { |
| 30 | + $lb->clearLagTimeCache(); |
30 | 31 | $lags = $lb->getLagTimes(); |
31 | 32 | unset( $lags[0] ); |
32 | | - $this->output( gmdate( 'H:i:s' ) . ' ' ); |
| 33 | + echo gmdate( 'H:i:s' ) . ' '; |
33 | 34 | foreach( $lags as $i => $lag ) { |
34 | | - $this->output( sprintf( "%-12s " , $lag === false ? 'false' : $lag ) ); |
| 35 | + printf( "%-12s " , $lag === false ? 'false' : $lag ); |
35 | 36 | } |
36 | | - $this->output( "\n" ); |
| 37 | + echo "\n"; |
37 | 38 | sleep( 5 ); |
38 | 39 | } |
39 | 40 | } else { |