X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FThumbnailRenderJob.php;h=63575ebeca48fa7d405c4b2c4500f3dc6bd40296;hb=cbc61690442f21c1d20860dfdc512134ae567157;hp=49eabbba25da9536d573daee7af39e0a006c7ecc;hpb=a0b490bbe7a87b54de49f075c59befa8232b2237;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/ThumbnailRenderJob.php b/includes/jobqueue/jobs/ThumbnailRenderJob.php index 49eabbba25..63575ebeca 100644 --- a/includes/jobqueue/jobs/ThumbnailRenderJob.php +++ b/includes/jobqueue/jobs/ThumbnailRenderJob.php @@ -103,8 +103,10 @@ class ThumbnailRenderJob extends Job { wfDebug( __METHOD__ . ": hitting url {$thumbUrl}\n" ); + // T203135 We don't wait for the request to complete, as this is mostly fire & forget. + // Looking at the HTTP status of requests that take less than 1s is a sanity check. $request = MWHttpRequest::factory( $thumbUrl, - [ 'method' => 'HEAD', 'followRedirects' => true ], + [ 'method' => 'HEAD', 'followRedirects' => true, 'timeout' => 1 ], __METHOD__ ); @@ -122,10 +124,26 @@ class ThumbnailRenderJob extends Job { return true; } elseif ( $statusCode ) { $this->setLastError( __METHOD__ . ": incorrect HTTP status $statusCode when hitting $thumbUrl" ); + } elseif ( $status->hasMessage( 'http-timed-out' ) ) { + // T203135 we ignore timeouts, as it would be inefficient for this job to wait for + // minutes for the slower thumbnails to complete. + return true; } else { $this->setLastError( __METHOD__ . ': HTTP request failure: ' . Status::wrap( $status )->getWikiText( null, null, 'en' ) ); } return false; } + + /** + * Whether to retry the job. + * @return bool + */ + public function allowRetries() { + // ThumbnailRenderJob is a warmup for the thumbnails cache, + // so loosing it is not a problem. Most times the job fails + // for non-renderable or missing images which will not be fixed + // by a retry, but will create additional load on the renderer. + return false; + } }