jenkins-bot has submitted this change and it was merged. Change subject: SessionBackend: skip isUserSessionPrevented check for anons ......................................................................
SessionBackend: skip isUserSessionPrevented check for anons For anon requests, the call to SessionManager::isUserSessionPrevented( $this->user->getName() ) is both expensive (because of the need to sanitize the IP) and pointless, because the session-prevention feature is intended for named accounts. So short-circuit the check if the user is not logged in. Change-Id: I17386b97e229b492723b46db1e1ae16fd4b0fc5a (cherry picked from commit 43420a0506b3115833d4b5d11b9e56579a967cdd) --- M includes/session/SessionBackend.php 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/session/SessionBackend.php b/includes/session/SessionBackend.php index 5cf7869..977bb71 100644 --- a/includes/session/SessionBackend.php +++ b/includes/session/SessionBackend.php @@ -572,7 +572,9 @@ * @param bool $closing Whether the session is being closed */ public function save( $closing = false ) { - if ( $this->provider->getManager()->isUserSessionPrevented( $this->user->getName() ) ) { + $anon = $this->user->isAnon(); + + if ( !$anon && $this->provider->getManager()->isUserSessionPrevented( $this->user->getName() ) ) { $this->logger->debug( 'SessionBackend "{session}" not saving, user {user} was ' . 'passed to SessionManager::preventSessionsForUser', @@ -585,7 +587,6 @@ // Ensure the user has a token // @codeCoverageIgnoreStart - $anon = $this->user->isAnon(); if ( !$anon && !$this->user->getToken( false ) ) { $this->logger->debug( 'SessionBackend "{session}" creating token for user {user} on save', -- To view, visit https://gerrit.wikimedia.org/r/273180 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I17386b97e229b492723b46db1e1ae16fd4b0fc5a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.27.0-wmf.14 Gerrit-Owner: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits