Demon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/57337
Change subject: Propogate Http errors back up in the form of a Status
......................................................................
Propogate Http errors back up in the form of a Status
Change-Id: I6146781d5cf26029809699f576fde0c21dab0906
---
M MWSearch_body.php
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MWSearch
refs/changes/37/57337/1
diff --git a/MWSearch_body.php b/MWSearch_body.php
index 7a2642e..4dc9685 100644
--- a/MWSearch_body.php
+++ b/MWSearch_body.php
@@ -475,22 +475,25 @@
wfDebug( "Fetching search data from $searchUrl\n" );
$work = new PoolCounterWorkViaCallback( 'LuceneSearchRequest',
"_lucene:host:$host",
- array( 'doWork' => function() use ( $host, $searchUrl,
$httpOpts ) {
+ array( 'doWork' => function() use ( $host, $searchUrl )
{
global $wgLuceneSearchTimeout;
wfSuppressWarnings();
$httpProfile ="LuceneSearchSet::newFromQuery" .
'-contact-' . $host;
wfProfileIn( $httpProfile );
- $data = Http::get( $searchUrl,
$wgLuceneSearchTimeout, $httpOpts );
+ $req = MWHttpRequest::factory( $searchUrl,
+ array( 'proxy' => false, 'timeout' =>
$wgLuceneSearchTimeout ) );
+ $res = $req->execute();
+ $data = $res && $res->isGood() ?
$req->getContent() : $res;
wfProfileOut( $httpProfile );
wfRestoreWarnings();
return $data;
} ) );
$data = $work->execute();
- if( $data === false ) {
+ if( $data instanceof Status ) {
// Network error or server error
wfProfileOut( __METHOD__ );
- return null;
+ return $data;
} else {
$inputLines = explode( "\n", trim( $data ) );
$resultLines = array_map( 'trim', $inputLines );
--
To view, visit https://gerrit.wikimedia.org/r/57337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6146781d5cf26029809699f576fde0c21dab0906
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MWSearch
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits