jenkins-bot has submitted this change and it was merged.
Change subject: Add profiling to Echo notification API
......................................................................
Add profiling to Echo notification API
Change-Id: I427622aa67037e33eabab02c0adf13a2abf59377
---
M api/ApiEchoNotifications.php
1 file changed, 15 insertions(+), 0 deletions(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/api/ApiEchoNotifications.php b/api/ApiEchoNotifications.php
index 444896f..4cad169 100644
--- a/api/ApiEchoNotifications.php
+++ b/api/ApiEchoNotifications.php
@@ -7,6 +7,7 @@
}
public function execute() {
+ wfProfileIn( __METHOD__ );
// To avoid API warning, register the parameter used to bust
browser cache
$this->getMain()->getVal( '_' );
@@ -22,6 +23,7 @@
if ( in_array( 'list', $prop ) ) {
// Group notification results by section
if ( $params['groupbysection'] ) {
+ wfProfileIn( __METHOD__ . '-group-by-section' );
foreach ( $params['sections'] as $section ) {
$result[$section] =
$this->getSectionPropList(
$user, $section,
$params['limit'],
@@ -34,7 +36,9 @@
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
}
}
+ wfProfileOut( __METHOD__ . '-group-by-section'
);
} else {
+ wfProfileIn( __METHOD__ . '-group-by-none' );
$attributeManager =
EchoAttributeManager::newFromGlobalVars();
$result = $this->getPropList(
$user,
@@ -47,18 +51,22 @@
$result['index'] = $this->getPropIndex(
$result['list'] );
$this->getResult()->setIndexedTagName(
$result['index'], 'id' );
}
+ wfProfileOut( __METHOD__ . '-group-by-none' );
}
}
if ( in_array( 'count', $prop ) ) {
+ wfProfileIn( __METHOD__ . '-count' );
$result = array_merge_recursive(
$result,
$this->getPropcount( $user,
$params['sections'], $params['groupbysection'] )
);
+ wfProfileOut( __METHOD__ . '-count' );
}
$this->getResult()->setIndexedTagName( $result, 'notification'
);
$this->getResult()->addValue( 'query', $this->getModuleName(),
$result );
+ wfProfileOut( __METHOD__ );
}
/**
@@ -119,6 +127,7 @@
// Unread notifications + possbile 3 read notification
depending on result number
// We don't care about next offset in this case
if ( $unreadFirst ) {
+ wfProfileIn( __METHOD__ . '-fetch-data-unread-first' );
$notifs = $notifMapper->fetchUnreadByUser( $user,
$limit, $eventTypes );
// If there are less unread notifications than we
requested,
// then fill the result with some read notifications
@@ -137,12 +146,18 @@
}
}
}
+ wfProfileOut( __METHOD__ . '-fetch-data-unread-first' );
} else {
+ wfProfileIn( __METHOD__ . '-fetch-data' );
$notifs = $notifMapper->fetchByUser( $user, $limit + 1,
$continue, $eventTypes );
+ wfProfileOut( __METHOD__ . '-fetch-data' );
}
+
+ wfProfileIn( __METHOD__ . '-formatting' );
foreach ( $notifs as $notif ) {
$result['list'][$notif->getEvent()->getID()] =
EchoDataOutputFormatter::formatOutput( $notif, $format, $user );
}
+ wfProfileOut( __METHOD__ . '-formatting' );
// Generate offset if necessary
if ( !$unreadFirst ) {
--
To view, visit https://gerrit.wikimedia.org/r/156737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I427622aa67037e33eabab02c0adf13a2abf59377
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits