Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284932
Change subject: Avoid always using DB_MASTER with ?CentralAuthLatest=1
......................................................................
Avoid always using DB_MASTER with ?CentralAuthLatest=1
Only use it in the rare case that ChronologyProtector gave up.
This should avoid more pointless DB master traffic.
Bug: T92357
Change-Id: I20a9fa331969c8d03bbb71bdb998d19e19311333
---
M includes/CentralAuthUser.php
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/32/284932/1
diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index e927554..2443d8d 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -180,8 +180,17 @@
public static function centralLBHasRecentMasterChanges() {
global $wgCentralAuthDatabase;
- return RequestContext::getMain()->getRequest()->getCheck(
'CentralAuthLatest' )
- || wfGetLB( $wgCentralAuthDatabase
)->hasOrMadeRecentMasterChanges();
+ $lb = wfGetLB( $wgCentralAuthDatabase );
+ if ( $lb->hasOrMadeRecentMasterChanges() ) {
+ return true; // changes already made in this request
+ }
+
+ return (
+ // Request followed redirect from a write request
response
+ RequestContext::getMain()->getRequest()->getCheck(
'CentralAuthLatest' )
+ // ... and ChronologyProtector timed out waiting on a
slave (before or now)
+ && $lb->getLaggedSlaveMode( $wgCentralAuthDatabase )
+ );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/284932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I20a9fa331969c8d03bbb71bdb998d19e19311333
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits