From cb095287f0b51217073e00f26c126a004476522d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 12 Oct 2009 23:54:48 +0000 Subject: [PATCH] * (bug 20595) Don't increment ping value right after setting it the first time (jumping from 0 -> 2) * Use memc->set() rather than using add(). The later just does an existence check on the current key, which is useless here. --- includes/User.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/User.php b/includes/User.php index ffc0963700..29b818430c 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1283,6 +1283,7 @@ class User { list( $max, $period ) = $limit; $summary = "(limit $max in {$period}s)"; $count = $wgMemc->get( $key ); + // Already pinged? if( $count ) { if( $count > $max ) { wfDebug( __METHOD__ . ": tripped! $key at $count $summary\n" ); @@ -1293,11 +1294,11 @@ class User { } else { wfDebug( __METHOD__ . ": ok. $key at $count $summary\n" ); } + $wgMemc->incr( $key ); } else { wfDebug( __METHOD__ . ": adding record for $key $summary\n" ); - $wgMemc->add( $key, 1, intval( $period ) ); + $wgMemc->set( $key, 1, intval( $period ) ); // first ping } - $wgMemc->incr( $key ); } wfProfileOut( __METHOD__ ); -- 2.20.1