From b47a86316dad7737d76a94c3de9895858e280750 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Wed, 4 Nov 2015 23:59:58 -0700 Subject: [PATCH] Fix name of PoolCounter callback in thumb.php The callback is named doCachedWork, not getCachedWork. The typo made it so that if multiple people try to render a file at once, MediaWiki would not check if the last person to go already did the needed work. This might not make as much difference as it would sound, as the pool counter lock is for the entire file, not a specific size, and I'm unsure if swift has an equivalent of "slave lag", where the check to see if a cached version is available might happen before the write is totally visible. Also merge the fallback handler into the error handler, so we get actually error messages reported. Change-Id: I12d228961de39cffc3d492554d93e30bd741adc9 --- thumb.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/thumb.php b/thumb.php index c699bb19ab..34f641d1ea 100644 --- a/thumb.php +++ b/thumb.php @@ -420,18 +420,15 @@ function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath 'doWork' => function () use ( $file, $params ) { return $file->transform( $params, File::RENDER_NOW ); }, - 'getCachedWork' => function () use ( $file, $params, $thumbPath ) { + 'doCachedWork' => 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, File::RENDER_NOW ) : false; // retry once more in exclusive mode }, - 'fallback' => function () { - return wfMessage( 'generic-pool-error' )->parse(); - }, 'error' => function ( Status $status ) { - return $status->getHTML(); + return wfMessage( 'generic-pool-error' )->parse() . '
' . $status->getHTML(); } ) ); -- 2.20.1