$cache->makeGlobalKey( __CLASS__, 'server-read-only', $masterServer ),
self::TTL_CACHE_READONLY,
function () use ( $wiki, $conn ) {
+ $this->trxProfiler->setSilenced( true );
try {
$dbw = $conn ?: $this->getConnection( DB_MASTER, [], $wiki );
- return (int)$dbw->serverIsReadOnly();
+ $readOnly = (int)$dbw->serverIsReadOnly();
} catch ( DBError $e ) {
- return 0;
+ $readOnly = 0;
}
+ $this->trxProfiler->setSilenced( false );
+ return $readOnly;
},
[ 'pcTTL' => $cache::TTL_PROC_LONG, 'busyValue' => 0 ]
);
protected $dbLockThreshold = 3.0;
/** @var float Seconds */
protected $eventThreshold = .25;
+ /** @var bool */
+ protected $silenced = false;
/** @var array transaction ID => (write start time, list of DBs involved) */
protected $dbTrxHoldingLocks = [];
$this->logger = $logger;
}
+ /**
+ * @param bool $value
+ * @since 1.28
+ */
+ public function setSilenced( $value ) {
+ $this->silenced = $value;
+ }
+
/**
* Set performance expectations
*
* @param string|float|int $actual [optional]
*/
protected function reportExpectationViolated( $expect, $query, $actual = null ) {
+ if ( $this->silenced ) {
+ return;
+ }
+
$n = $this->expect[$expect];
$by = $this->expectBy[$expect];
$actual = ( $actual !== null ) ? " (actual: $actual)" : "";