Change-Id: Ibf268b646a9eb2acfaa649d634c5278133091158
register_shutdown_function( function() use ( &$done, $key ) {
if ( !$done ) { // transform() gave a fatal
global $wgMemc;
register_shutdown_function( function() use ( &$done, $key ) {
if ( !$done ) { // transform() gave a fatal
global $wgMemc;
- $wgMemc->incrWithInit( $key, 3600 );
+ // Randomize TTL to reduce stampedes
+ $wgMemc->incrWithInit( $key, 3600 + mt_rand( 0, 300 ) );
$done = true; // no PHP fatal occured
if ( !$thumb || $thumb->isError() ) {
$done = true; // no PHP fatal occured
if ( !$thumb || $thumb->isError() ) {
- $wgMemc->incrWithInit( $key, 3600 );
+ // Randomize TTL to reduce stampedes
+ $wgMemc->incrWithInit( $key, 3600 + mt_rand( 0, 300 ) );
}
return array( $thumb, $errorHtml );
}
return array( $thumb, $errorHtml );