Use ProfileSection in FileOpBatch
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 3 Feb 2014 20:11:59 +0000 (12:11 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 3 Feb 2014 20:59:04 +0000 (12:59 -0800)
Change-Id: I5453130f89a2b46a18dc6ecfb23b2f75c6c2f16f

includes/filebackend/FileOpBatch.php

index 32b65ba..9fd1eb5 100644 (file)
@@ -55,14 +55,12 @@ class FileOpBatch {
         * @return Status
         */
        public static function attempt( array $performOps, array $opts, FileJournal $journal ) {
-               wfProfileIn( __METHOD__ );
+               $section = new ProfileSection( __METHOD__ );
                $status = Status::newGood();
 
                $n = count( $performOps );
                if ( $n > self::MAX_BATCH_SIZE ) {
                        $status->fatal( 'backend-fail-batchsize', $n, self::MAX_BATCH_SIZE );
-                       wfProfileOut( __METHOD__ );
-
                        return $status;
                }
 
@@ -108,8 +106,6 @@ class FileOpBatch {
                                $status->success[$index] = false;
                                ++$status->failCount;
                                if ( !$ignoreErrors ) {
-                                       wfProfileOut( __METHOD__ );
-
                                        return $status; // abort
                                }
                        }
@@ -123,8 +119,6 @@ class FileOpBatch {
                if ( count( $entries ) ) {
                        $subStatus = $journal->logChangeBatch( $entries, $batchId );
                        if ( !$subStatus->isOK() ) {
-                               wfProfileOut( __METHOD__ );
-
                                return $subStatus; // abort
                        }
                }
@@ -136,8 +130,6 @@ class FileOpBatch {
                // Attempt each operation (in parallel if allowed and possible)...
                self::runParallelBatches( $pPerformOps, $status );
 
-               wfProfileOut( __METHOD__ );
-
                return $status;
        }