Skip to content

Commit

Permalink
Set LoadMonitor (#5759)
Browse files Browse the repository at this point in the history
It appears that this is the default here
https://github.com/wikimedia/mediawiki/blob/4bd27f449569c211f6e74fa48e4e6ed6506d4a27/includes/libs/rdbms/lbfactory/LBFactoryMulti.php#L159

But we want to set maxConnCount I think, as some times we have an issue
where a db server goes down it gets overloaded when it is back online.
It's basically the same fix as https://phabricator.wikimedia.org/T360930

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
paladox and github-actions authored Dec 6, 2024
1 parent 85eada5 commit 22aa68f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@
];
}

$wgLBFactoryConf['loadMonitor']['class'] = '\Wikimedia\Rdbms\LoadMonitor';
// Disable LoadMonitor in CLI, it doesn't provide much value in CLI.
if ( PHP_SAPI === 'cli' ) {
$wgLBFactoryConf['loadMonitorClass'] = \Wikimedia\Rdbms\LoadMonitorNull::class;
$wgLBFactoryConf['loadMonitor']['class'] = '\Wikimedia\Rdbms\LoadMonitorNull';
}

$wgLBFactoryConf['loadMonitor']['maxConnCount'] = 350;

// Disallow web request database transactions that are slower than 10 seconds
$wgMaxUserDBWriteDuration = 10;

Expand Down
6 changes: 3 additions & 3 deletions LocalWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,13 +697,13 @@ function onBeforePageDisplay( OutputPage $out ) {

break;
case 'testwikibeta':
$wgUserLevels = array(
$wgUserLevels = [
'Recruit' => 0,
'Apprentice' => 1200,
'Private' => 1750,
'Corporal' => 2500,
'Sergeant' => 5000,
'Gunnery Sergeant' =>10000,
'Gunnery Sergeant' => 10000,
'Lieutenant' => 20000,
'Captain' => 35000,
'Major' => 50000,
Expand All @@ -716,7 +716,7 @@ function onBeforePageDisplay( OutputPage $out ) {
'Lieutenant General' => 650000,
'General' => 800000,
'General of the Army' => 1000000,
);
];
break;
case 'tuscriaturaswiki':
$wgHooks['AfterFinalPageOutput'][] = 'onAfterFinalPageOutput';
Expand Down
2 changes: 1 addition & 1 deletion rpc/RunJobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

use MediaWiki\MediaWikiServices;

if ( !in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '0:0:0:0:0:0:0:1', '::1' ), true ) ) {
if ( !in_array( $_SERVER['REMOTE_ADDR'], [ '127.0.0.1', '0:0:0:0:0:0:0:1', '::1' ], true ) ) {
http_response_code( 500 );
die( "Only loopback requests are allowed.\n" );
} elseif ( $_SERVER['REQUEST_METHOD'] !== 'POST' ) {
Expand Down

0 comments on commit 22aa68f

Please sign in to comment.