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
'doWork' => function () use ( $file, $params ) {
return $file->transform( $params, File::RENDER_NOW );
},
'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
},
// 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 ) {
'error' => function ( Status $status ) {
- return $status->getHTML();
+ return wfMessage( 'generic-pool-error' )->parse() . '<hr>' . $status->getHTML();