From aafaea29f3b3f0a31f720d3bec1d506aa8a82cc1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 28 Sep 2017 12:05:03 +0200 Subject: [PATCH] Distinguish GET from POST for PostSend expectations This avoids needless log entries for POST requests. Bug: T166199 Change-Id: I515fde1f619f7f016d08b7c270a1c155ee171bf9 --- includes/DefaultSettings.php | 10 ++++++++-- includes/MediaWiki.php | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d462228ed2..780976a1c8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6146,8 +6146,8 @@ $wgTrxProfilerLimits = [ 'writes' => 0, 'readQueryTime' => 5 ], - // Deferred updates that run after HTTP response is sent - 'PostSend' => [ + // Deferred updates that run after HTTP response is sent for GET requests + 'PostSend-GET' => [ 'readQueryTime' => 5, 'writeQueryTime' => 1, 'maxAffected' => 1000, @@ -6155,6 +6155,12 @@ $wgTrxProfilerLimits = [ 'masterConns' => 0, 'writes' => 0, ], + // Deferred updates that run after HTTP response is sent for POST requests + 'PostSend-POST' => [ + 'readQueryTime' => 5, + 'writeQueryTime' => 1, + 'maxAffected' => 1000 + ], // Background job runner 'JobRunner' => [ 'readQueryTime' => 30, diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 0f40c19201..43de4ba375 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -884,7 +884,9 @@ class MediaWiki { $trxProfiler = Profiler::instance()->getTransactionProfiler(); $trxProfiler->resetExpectations(); $trxProfiler->setExpectations( - $this->config->get( 'TrxProfilerLimits' )['PostSend'], + $this->context->getRequest()->hasSafeMethod() + ? $this->config->get( 'TrxProfilerLimits' )['PostSend-GET'] + : $this->config->get( 'TrxProfilerLimits' )['PostSend-POST'], __METHOD__ ); -- 2.20.1