"jakub-onderka/php-parallel-lint": "0.9.2",
"jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
"justinrainbow/json-schema": "~5.2",
- "mediawiki/mediawiki-codesniffer": "0.11.0",
+ "mediawiki/mediawiki-codesniffer": "0.12.0",
"monolog/monolog": "~1.22.1",
"nikic/php-parser": "2.1.0",
"nmred/kafka-php": "0.1.5",
}
$age = time() - wfTimestamp( TS_UNIX, $mtime );
- $adaptiveTTL = max( .9 * $age, $minTTL );
+ $adaptiveTTL = max( 0.9 * $age, $minTTL );
$adaptiveTTL = min( $adaptiveTTL, $maxTTL );
$this->lowerCdnMaxage( (int)$adaptiveTTL );
return; // invalid storage path
}
$mtime = ConvertibleTimestamp::convert( TS_UNIX, $val['mtime'] );
- $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, .1 );
+ $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, 0.1 );
$key = $this->fileCacheKey( $path );
// Set the cache unless it is currently salted.
$this->memCache->set( $key, $val, $ttl );
$lSince = microtime( true ); // lock timestamp
return new ScopedCallback( function () use ( $key, $lSince, $expiry ) {
- $latency = .050; // latency skew (err towards keeping lock present)
+ $latency = 0.050; // latency skew (err towards keeping lock present)
$age = ( microtime( true ) - $lSince + $latency );
if ( ( $age + $latency ) >= $expiry ) {
$this->logger->warning( "Lock for $key held too long ($age sec)." );
protected function applyDefaultParams( $params ) {
return $params + [
'compress_threshold' => 1500,
- 'connect_timeout' => .5,
+ 'connect_timeout' => 0.5,
'debug' => false
];
}
* @return int Adaptive TTL
* @since 1.28
*/
- public function adaptiveTTL( $mtime, $maxTTL, $minTTL = 30, $factor = .2 ) {
+ public function adaptiveTTL( $mtime, $maxTTL, $minTTL = 30, $factor = 0.2 ) {
if ( is_float( $mtime ) || ctype_digit( $mtime ) ) {
$mtime = (int)$mtime; // handle fractional seconds and string integers
}
/** @var float Seconds */
protected $dbLockThreshold = 3.0;
/** @var float Seconds */
- protected $eventThreshold = .25;
+ protected $eventThreshold = 0.25;
/** @var bool */
protected $silenced = false;
const PING_TTL = 1.0;
const PING_QUERY = 'SELECT 1 AS ping';
- const TINY_WRITE_SEC = .010;
- const SLOW_WRITE_SEC = .500;
+ const TINY_WRITE_SEC = 0.010;
+ const SLOW_WRITE_SEC = 0.500;
const SMALL_WRITE_ROWS = 100;
/** @var string SQL query */
$newWeight = $movAveRatio * $coefficient + ( 1 - $movAveRatio ) * $lastWeight;
// Scale from 10% to 100% of nominal weight
- $weightScales[$i] = max( $newWeight, .10 );
+ $weightScales[$i] = max( $newWeight, 0.10 );
if ( !$conn ) {
$lagTimes[$i] = false;
// finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, MIN_AR_TTL)
// Current values imply that m=3933.333333 and b=-333.333333
// See https://www.nngroup.com/articles/website-response-times/
- const PARSE_FAST_SEC = .100; // perceived "fast" page parse
+ const PARSE_FAST_SEC = 0.100; // perceived "fast" page parse
const PARSE_SLOW_SEC = 1.0; // perceived "slow" page parse
const FAST_AR_TTL = 60; // adaptive TTL for "fast" pages
const SLOW_AR_TTL = 3600; // adaptive TTL for "slow" pages
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
<exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
+ <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
+ <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
+ <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
</rule>
<rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
<properties>
[ -30281104, TS_MW, '19690115123456', 'Negative TS_UNIX to TS_MW' ],
[ $t, TS_UNIX, 979562096, 'TS_UNIX to TS_UNIX' ],
[ $t, TS_DB, '2001-01-15 12:34:56', 'TS_UNIX to TS_DB' ],
- [ $t + .01, TS_MW, '20010115123456', 'TS_UNIX float to TS_MW' ],
+ [ $t + 0.01, TS_MW, '20010115123456', 'TS_UNIX float to TS_MW' ],
[ $t, TS_ISO_8601_BASIC, '20010115T123456Z', 'TS_ISO_8601_BASIC to TS_DB' ],
public static function provideAdaptiveTTL() {
return [
- [ 3600, 900, 30, .2, 720 ],
- [ 3600, 500, 30, .2, 500 ],
- [ 3600, 86400, 800, .2, 800 ],
- [ false, 86400, 800, .2, 800 ],
- [ null, 86400, 800, .2, 800 ]
+ [ 3600, 900, 30, 0.2, 720 ],
+ [ 3600, 500, 30, 0.2, 500 ],
+ [ 3600, 86400, 800, 0.2, 800 ],
+ [ false, 86400, 800, 0.2, 800 ],
+ [ null, 86400, 800, 0.2, 800 ]
];
}
$tp->setLogger( $logger );
$tp->setExpectation( 'queries', 2, __METHOD__ );
- $tp->recordQueryCompletion( "SQL 1", microtime( true ) - .01, false, 0 );
- $tp->recordQueryCompletion( "SQL 2", microtime( true ) - .01, false, 0 );
- $tp->recordQueryCompletion( "SQL 3", microtime( true ) - .01, false, 0 ); // warn
- $tp->recordQueryCompletion( "SQL 4", microtime( true ) - .01, false, 0 ); // warn
+ $tp->recordQueryCompletion( "SQL 1", microtime( true ) - 0.01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 2", microtime( true ) - 0.01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 3", microtime( true ) - 0.01, false, 0 ); // warn
+ $tp->recordQueryCompletion( "SQL 4", microtime( true ) - 0.01, false, 0 ); // warn
}
public function testWriteQueryCount() {
$tp->setLogger( $logger );
$tp->setExpectation( 'writes', 2, __METHOD__ );
- $tp->recordQueryCompletion( "SQL 1", microtime( true ) - .01, false, 0 );
- $tp->recordQueryCompletion( "SQL 2", microtime( true ) - .01, false, 0 );
- $tp->recordQueryCompletion( "SQL 3", microtime( true ) - .01, false, 0 );
- $tp->recordQueryCompletion( "SQL 4", microtime( true ) - .01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 1", microtime( true ) - 0.01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 2", microtime( true ) - 0.01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 3", microtime( true ) - 0.01, false, 0 );
+ $tp->recordQueryCompletion( "SQL 4", microtime( true ) - 0.01, false, 0 );
$tp->transactionWritingIn( 'srv1', 'db1', '123' );
- $tp->recordQueryCompletion( "SQL 1w", microtime( true ) - .01, true, 2 );
- $tp->recordQueryCompletion( "SQL 2w", microtime( true ) - .01, true, 5 );
- $tp->recordQueryCompletion( "SQL 3w", microtime( true ) - .01, true, 3 );
- $tp->recordQueryCompletion( "SQL 4w", microtime( true ) - .01, true, 1 );
+ $tp->recordQueryCompletion( "SQL 1w", microtime( true ) - 0.01, true, 2 );
+ $tp->recordQueryCompletion( "SQL 2w", microtime( true ) - 0.01, true, 5 );
+ $tp->recordQueryCompletion( "SQL 3w", microtime( true ) - 0.01, true, 3 );
+ $tp->recordQueryCompletion( "SQL 4w", microtime( true ) - 0.01, true, 1 );
$tp->transactionWritingOut( 'srv1', 'db1', '123', 1, 1 );
}
}
$db->setLBInfo( 'clusterMasterHost', 'db1052' );
$lagEst = $db->getLag();
- $this->assertGreaterThan( $lag - .010, $lagEst, "Correct heatbeat lag" );
- $this->assertLessThan( $lag + .010, $lagEst, "Correct heatbeat lag" );
+ $this->assertGreaterThan( $lag - 0.010, $lagEst, "Correct heatbeat lag" );
+ $this->assertLessThan( $lag + 0.010, $lagEst, "Correct heatbeat lag" );
}
public static function provideLagAmounts() {