J has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68645


Change subject: Update transcode table with more errors if job fails
......................................................................

Update transcode table with more errors if job fails

Change-Id: Id64739f15d2b82f42409a4b1cf5c53a4b7933d26
---
M WebVideoTranscode/WebVideoTranscodeJob.php
1 file changed, 6 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/45/68645/1

diff --git a/WebVideoTranscode/WebVideoTranscodeJob.php 
b/WebVideoTranscode/WebVideoTranscodeJob.php
index a6c1c60..9d86571 100644
--- a/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -92,7 +92,7 @@
         * @param $error string
         *
         */
-       private function updateTranscodeError($transcodeKey, $error){
+       private function setTranscodeError($transcodeKey, $error){
                $dbw = wfGetDB( DB_MASTER );
                $dbw->update(
                        'transcode',
@@ -107,6 +107,7 @@
                        __METHOD__,
                        array( 'LIMIT' => 1 )
                );
+               $this->setLastError( $error );
        }
 
        /**
@@ -137,8 +138,7 @@
                if( !$this->getSourceFilePath() || !is_file( 
$this->getSourceFilePath() ) ){
                        $status = $this->title . ': Source not found ' . 
$this->getSourceFilePath();
                        $this->output( $status );
-                       $this->updateTranscodeError($transcodeKey, $status);
-                       $this->setLastError( $status );
+                       $this->setTranscodeError($transcodeKey, $status);
                        return false;
                }
 
@@ -220,7 +220,7 @@
                        $this->output('Possible Error, transcode task 
restarted, removed, or completed while transcode was in progress');
                        // if an error; just error out, we can't remove temp 
files or update states, because the new job may be doing stuff.
                        if( $status !== true ){
-                               $this->setLastError( $status );
+                               $this->setTranscodeError($transcodeKey, 
$status);
                                return false;
                        }
                        // else just continue with db updates, and when the new 
job comes around it won't start because it will see
@@ -240,11 +240,10 @@
                                WebVideoTranscode::getDerivativeFilePath( 
$file, $transcodeKey ) // storage
                        );
                        if ( !$result->isOK() ) {
-                               $this->updateTranscodeError( $transcodeKey, 
$result );
                                // no need to invalidate all pages with video. 
Because all pages remain valid ( no $transcodeKey derivative )
                                // just clear the file page ( so that the 
transcode table shows the error )
                                $this->title->invalidateCache();
-                               $this->setLastError( $result );
+                               $this->setTranscodeError( $transcodeKey, 
$result );
                                $status = false;
                        } else {
                                $bitrate = round( intval( filesize( 
$this->getTargetEncodePath() ) /  $file->getLength() ) * 8 );
@@ -268,7 +267,7 @@
                        }
                } else {
                        // Update the transcode table with failure time and 
error
-                       $this->updateTranscodeError( $transcodeKey, $status );
+                       $this->setTranscodeError( $transcodeKey, $status );
                        // no need to invalidate all pages with video. Because 
all pages remain valid ( no $transcodeKey derivative )
                        // just clear the file page ( so that the transcode 
table shows the error )
                        $this->title->invalidateCache();

-- 
To view, visit https://gerrit.wikimedia.org/r/68645
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id64739f15d2b82f42409a4b1cf5c53a4b7933d26
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: J <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to