mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Avoid primary DB query for non-talk page edits
While investigating primary database queries as part of T370304, we found that EventDispatcher currently issues a primary DB query to fetch the previous revision of the newly created revision on every edit, but discards the result for non-talk pages. So, as an optimization, have it fetch the previous revision only after the page has been established to be a talk page. Bug: T370304 Change-Id: I301f5c3c002c6953ef0b3919a33667a809342b84
This commit is contained in:
parent
b27574f0b6
commit
b05a51beb6
|
@ -53,9 +53,6 @@ class EventDispatcher {
|
||||||
public static function generateEventsForRevision( array &$events, RevisionRecord $newRevRecord ): void {
|
public static function generateEventsForRevision( array &$events, RevisionRecord $newRevRecord ): void {
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
|
|
||||||
$revisionStore = $services->getRevisionStore();
|
|
||||||
$oldRevRecord = $revisionStore->getPreviousRevision( $newRevRecord, IDBAccessObject::READ_LATEST );
|
|
||||||
|
|
||||||
$title = Title::newFromLinkTarget(
|
$title = Title::newFromLinkTarget(
|
||||||
$newRevRecord->getPageAsLinkTarget()
|
$newRevRecord->getPageAsLinkTarget()
|
||||||
);
|
);
|
||||||
|
@ -71,6 +68,9 @@ class EventDispatcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$revisionStore = $services->getRevisionStore();
|
||||||
|
$oldRevRecord = $revisionStore->getPreviousRevision( $newRevRecord, IDBAccessObject::READ_LATEST );
|
||||||
|
|
||||||
if ( $oldRevRecord !== null ) {
|
if ( $oldRevRecord !== null ) {
|
||||||
$oldItemSet = static::getParsedRevision( $oldRevRecord );
|
$oldItemSet = static::getParsedRevision( $oldRevRecord );
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue