From: Gilles Dubuc Date: Mon, 3 Sep 2018 09:09:08 +0000 (+0200) Subject: Don't wait for thumbnails that take long to render X-Git-Tag: 1.34.0-rc.0~4182^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/D%D1%83%D0%BD%D0%B0?a=commitdiff_plain;h=2954003a95ae55566f63c532e5327e01e9127bd9;p=lhc%2Fweb%2Fwiklou.git Don't wait for thumbnails that take long to render The prerendering job is an optimization, should thumbnails fail to prerender, they will be reattempted when a user views them again. Bug: T203135 Change-Id: I2907bf10a2d22af9beffc530856f458a6adbfe45 --- diff --git a/includes/jobqueue/jobs/ThumbnailRenderJob.php b/includes/jobqueue/jobs/ThumbnailRenderJob.php index 49eabbba25..f87a33691d 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,6 +124,10 @@ 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' ) );