- ILoadBalancer $lb, BagOStuff $srvCache, BagOStuff $cache, array $options = []
+ ILoadBalancer $lb, BagOStuff $srvCache, WANObjectCache $wCache, array $options = []
if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) {
$this->srvCache->set( $key, $value, $staleTTL );
$this->replLogger->debug( __METHOD__ . ": got lag times ($key) from main cache" );
if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) {
$this->srvCache->set( $key, $value, $staleTTL );
$this->replLogger->debug( __METHOD__ . ": got lag times ($key) from main cache" );
- if ( $this->mainCache->lock( $key, 0, 10 ) ) {
- # Let this process alone update the cache value
- $cache = $this->mainCache;
+ if ( $this->srvCache->lock( $key, 0, 10 ) ) {
+ # Let only this process update the cache value on this server
+ $sCache = $this->srvCache;
- $unlocker = new ScopedCallback( function () use ( $cache, $key ) {
- $cache->unlock( $key );
+ $unlocker = new ScopedCallback( function () use ( $sCache, $key ) {
+ $sCache->unlock( $key );
} );
} elseif ( $staleValue ) {
# Could not acquire lock but an old cache exists, so use it
} );
} elseif ( $staleValue ) {
# Could not acquire lock but an old cache exists, so use it
- $this->replLogger->error( __METHOD__ . ": host $host is unreachable" );
+ $this->replLogger->error(
+ __METHOD__ . ": host {db_server} is unreachable",
+ [ 'db_server' => $host ]
+ );
$lagTimes[$i] = $conn->getLag();
if ( $lagTimes[$i] === false ) {
$host = $this->parent->getServerName( $i );
$lagTimes[$i] = $conn->getLag();
if ( $lagTimes[$i] === false ) {
$host = $this->parent->getServerName( $i );
- $this->replLogger->error( __METHOD__ . ": host $host is not replicating?" );
+ $this->replLogger->error(
+ __METHOD__ . ": host {db_server} is not replicating?",
+ [ 'db_server' => $host ]
+ );
'weightScales' => $weightScales,
'timestamp' => microtime( true )
];
'weightScales' => $weightScales,
'timestamp' => microtime( true )
];
$this->srvCache->set( $key, $value, $staleTTL );
$this->replLogger->info( __METHOD__ . ": re-calculated lag times ($key)" );
$this->srvCache->set( $key, $value, $staleTTL );
$this->replLogger->info( __METHOD__ . ": re-calculated lag times ($key)" );