Update context stats in SiteStatsUpdate
In addition to updating the database / memcached, make SiteStatsUpdate also update the context stats object with the deltas it is processing. Change-Id: Icc12c07ab4233e1105a402b80d290bdb64df6ea7
This commit is contained in:
parent
a1368a3d9b
commit
6542746e6c
1 changed files with 12 additions and 0 deletions
|
|
@ -65,6 +65,8 @@ class SiteStatsUpdate implements DeferrableUpdate {
|
|||
public function doUpdate() {
|
||||
global $wgSiteStatsAsyncFactor;
|
||||
|
||||
$this->doUpdateContextStats();
|
||||
|
||||
$rate = $wgSiteStatsAsyncFactor; // convenience
|
||||
// If set to do so, only do actual DB updates 1 every $rate times.
|
||||
// The other times, just update "pending delta" values in memcached.
|
||||
|
|
@ -153,6 +155,16 @@ class SiteStatsUpdate implements DeferrableUpdate {
|
|||
return $activeUsers;
|
||||
}
|
||||
|
||||
protected function doUpdateContextStats() {
|
||||
$stats = RequestContext::getMain()->getStats();
|
||||
foreach ( array( 'edits', 'articles', 'pages', 'users', 'images' ) as $type ) {
|
||||
$delta = $this->$type;
|
||||
if ( $delta !== 0 ) {
|
||||
$stats->updateCount( "site.$type", $delta );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function doUpdatePendingDeltas() {
|
||||
$this->adjustPending( 'ss_total_edits', $this->edits );
|
||||
$this->adjustPending( 'ss_good_articles', $this->articles );
|
||||
|
|
|
|||
Loading…
Reference in a new issue