mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 15:30:42 +00:00
Defer af_throttled query to post-commit auto-commit mode
* Due to the nature of this code (a throttle) it will likely slam the DB, so push it after the end of the main transaction. bug: 60600 Change-Id: I48895358deaa1b951d849eeee14c7126cfa25ec8
This commit is contained in:
parent
f957c3b70a
commit
9a632d04ec
|
@ -1625,12 +1625,15 @@ class AbuseFilter {
|
|||
// More than $wgAbuseFilterEmergencyDisableCount matches,
|
||||
// constituting more than $emergencyDisableThreshold
|
||||
// (a fraction) of last few edits. Disable it.
|
||||
$method = __METHOD__;
|
||||
$dbw = wfGetDB( DB_MASTER );
|
||||
$dbw->update( 'abuse_filter',
|
||||
array( 'af_throttled' => 1 ),
|
||||
array( 'af_id' => $filter ),
|
||||
__METHOD__
|
||||
);
|
||||
$dbw->onTransactionIdle( function() use ( $dbw, $filter, $method ) {
|
||||
$dbw->update( 'abuse_filter',
|
||||
array( 'af_throttled' => 1 ),
|
||||
array( 'af_id' => $filter ),
|
||||
$method
|
||||
);
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue