$module = $this->setupModule();
$this->mModule = $module;
+ $this->setRequestExpectations( $module );
+
$this->checkExecutePermissions( $module );
if ( !$this->checkMaxLag( $module, $params ) ) {
}
}
+ /**
+ * Set database connection, query, and write expectations given this module request
+ * @param ApiBase $module
+ */
+ protected function setRequestExpectations( ApiBase $module ) {
+ $limits = $this->getConfig()->get( 'TrxProfilerLimits' );
+ $trxProfiler = Profiler::instance()->getTransactionProfiler();
+ if ( $this->getRequest()->wasPosted() ) {
+ if ( $module->isWriteMode() ) {
+ $trxProfiler->setExpectations( $limits['POST'], __METHOD__ );
+ } else {
+ $trxProfiler->setExpectations( $limits['POST-nonwrite'], __METHOD__ );
+ }
+ } else {
+ $trxProfiler->setExpectations( $limits['GET'], __METHOD__ );
+ }
+ }
+
/**
* Log the preceding request
* @param float $time Time in seconds