From 1b0603ce0f4f5547b8117ade8251866628d1aee6 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 19 May 2014 12:45:11 +0200 Subject: [PATCH] User::pingLimiter() profiles per action as well We had an outage beginning of may that involved rate limiting of the 'renderfile-nonstandard' action. This makes User::pingLimiter() to record a per action profiling point in addition to the generic one, that would let us finely graph actions being throttled. Ref: https://wikitech.wikimedia.org/wiki/Incident_documentation/20140503-Thumbnails#What_can_be_improved Bug: 65477 Change-Id: Iac7930e85f7d9101663656ccb2bccdbebf908693 --- RELEASE-NOTES-1.24 | 2 ++ includes/User.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index bb8dd22e0a..195ecef90f 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -60,6 +60,8 @@ changes to languages because of Bugzilla reports. * The deprecated function mw.util.toggleToc was removed. * The Special:Search hooks SpecialSearchGo and SpecialSearchResultsAppend were removed as they were unused. +* (bug 65477) User::pingLimiter() now has an additional profile point varying + by action being used. * mediawiki.util.$content no longer supports old versions of the Vector, Monobook, Modern and CologneBlue skins that don't yet implement the "mw-body" and/or "mw-body-primary" class name in their html. diff --git a/includes/User.php b/includes/User.php index 6578341acb..941a40509d 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1672,6 +1672,9 @@ class User { * Primitive rate limits: enforce maximum actions per time period * to put a brake on flooding. * + * The method generates both a generic profiling point and a per action one + * (suffix being "-$action". + * * @note When using a shared cache like memcached, IP-address * last-hit counters will be shared across wikis. * @@ -1698,6 +1701,7 @@ class User { global $wgMemc; wfProfileIn( __METHOD__ ); + wfProfileIn( __METHOD__ . '-' . $action ); $limits = $wgRateLimits[$action]; $keys = array(); @@ -1776,6 +1780,7 @@ class User { } } + wfProfileOut( __METHOD__ . '-' . $action ); wfProfileOut( __METHOD__ ); return $triggered; } -- 2.20.1