Avoid duplicate autopromote block key fetches

Bug: T133728
Change-Id: Ia3a955547e8147e92c7ca9782e399f9abd6d3949
This commit is contained in:
Aaron Schulz 2016-04-30 14:30:46 -07:00 committed by Ori.livneh
parent ef7a80ba60
commit 2807b5883a

View file

@ -279,7 +279,15 @@ class AbuseFilterHooks {
public static function onGetAutoPromoteGroups( $user, &$promote ) {
if ( $promote ) {
$key = AbuseFilter::autoPromoteBlockKey( $user );
if ( ObjectCache::getMainStashInstance()->get( $key ) ) {
$blocked = ObjectCache::getInstance( 'hash' )->getWithSetCallback(
$key,
30,
function () use ( $key ) {
return ObjectCache::getMainStashInstance()->get( $key );
}
);
if ( $blocked ) {
$promote = array();
}
}