diff options
author | Gergő Tisza <tgr.huwiki@gmail.com> | 2014-06-27 19:39:47 +0000 |
---|---|---|
committer | Gergő Tisza <tgr.huwiki@gmail.com> | 2014-06-27 19:39:47 +0000 |
commit | 3ee07d8bb4cad2eb265c140f92dd7169e601b2a1 (patch) | |
tree | c9bb3a25f8d86a8e07d9b3722e6695796967a898 /thumb.php | |
parent | 98fd36ef22b967960fd63ed29a6388011b473c90 (diff) | |
download | mediawikicore-3ee07d8bb4cad2eb265c140f92dd7169e601b2a1.tar.gz mediawikicore-3ee07d8bb4cad2eb265c140f92dd7169e601b2a1.zip |
Use separate PoolCounter config for expensive thumbnails
Depends on Ic62984e0f4a761642b2bdd1bfa362301ed94c284
and If40e223c328ddd15310d13f2a49000bf6e08200e
Bug: 65691
Change-Id: Ic737673b5a31974d866b9bf5afa4b4036baa03bb
Diffstat (limited to 'thumb.php')
-rw-r--r-- | thumb.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/thumb.php b/thumb.php index d7bf45338241..c611dc3ca75a 100644 --- a/thumb.php +++ b/thumb.php @@ -387,9 +387,17 @@ function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath $thumb = false; $errorHtml = false; + // guard thumbnail rendering with PoolCounter to avoid stampedes + // expensive files use a separate PoolCounter config so it is possible to set up a global limit on them + if ( $file->isExpensiveToThumbnail() ) { + $poolCounterType = 'FileRenderExpensive'; + } else { + $poolCounterType = 'FileRender'; + } + // Thumbnail isn't already there, so create the new thumbnail... try { - $work = new PoolCounterWorkViaCallback( 'FileRender', sha1( $file->getName() ), + $work = new PoolCounterWorkViaCallback( $poolCounterType, sha1( $file->getName() ), array( 'doWork' => function() use ( $file, $params ) { return $file->transform( $params, File::RENDER_NOW ); |