Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/130570
Change subject: Fixed "getCachedWork" callback in thumb.php to avoid 404s in the stream method ...................................................................... Fixed "getCachedWork" callback in thumb.php to avoid 404s in the stream method Change-Id: Id3781b87023291b9f7b2c7b3d8ae429a4065c227 --- M thumb.php 1 file changed, 9 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/70/130570/1 diff --git a/thumb.php b/thumb.php index c5da918..decbfaf 100644 --- a/thumb.php +++ b/thumb.php @@ -327,7 +327,7 @@ } // Actually generate a new thumbnail - list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName ); + list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath ); // Check for thumbnail generation errors... $msg = wfMessage( 'thumbnail_error' ); @@ -356,9 +356,10 @@ * @param File $file * @param array $params * @param string $thumbName + * @param string $thumbPath * @return array (MediaTransformOutput|bool, string|bool error message HTML) */ -function wfGenerateThumbnail( File $file, array $params, $thumbName ) { +function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath ) { global $wgMemc, $wgAttemptFailureEpoch; $key = wfMemcKey( 'attempt-failures', $wgAttemptFailureEpoch, @@ -389,8 +390,12 @@ 'doWork' => function() use ( $file, $params ) { return $file->transform( $params, File::RENDER_NOW ); }, - 'getCachedWork' => function() use ( $file, $params ) { - return $file->transform( $params ); + 'getCachedWork' => function() use ( $file, $params, $thumbPath ) { + // If the worker that finished made this thumbnail then use it. + // Otherwise, it probably made a different thumbnail for this file. + return $file->getRepo()->fileExists( $thumbPath ) + ? $file->transform( $params ) + : false; // retry once mork in exclusive mode }, 'fallback' => function() { return wfMessage( 'generic-pool-error' )->parse(); -- To view, visit https://gerrit.wikimedia.org/r/130570 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id3781b87023291b9f7b2c7b3d8ae429a4065c227 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits