-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failure check for ParallelExecution #1099
Fix failure check for ParallelExecution #1099
Conversation
An example to illustrate what has changed. <?php
require_once(__DIR__.'/init.php');
htmlHeader();
// create a client instance and autoload the customize request plugin
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
$client->getEndpoint()->setHost('server.invalid');
$query = $client->createSelect()->setQuery('inStock:true');
$parallel = $client->getPlugin('parallelexecution');
$parallel->addQuery('foobar', $query);
$results = $parallel->execute();
var_dump($results['foobar']);
htmlFooter(); With the current release:
With the proposed changes:
|
e93a86a
to
b7941ff
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1099 +/- ##
==========================================
- Coverage 97.49% 97.49% -0.01%
==========================================
Files 389 389
Lines 10148 10141 -7
==========================================
- Hits 9894 9887 -7
Misses 254 254
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
The reason I consider this a bugfix rather than a change is that the "empty"
If you don't check if you're dealing with a
|
a9e8942
to
baa1ee9
Compare
An endpoint failure for one of the results with
ParallelExecution
should throw anHttpException
just like it does for a regular request. The surest way to check this is the error number of the handle.The
null
check inCurl::getResponse()
is useless for this becausecurl_multi_getcontent()
doesn't returnnull
on failure (it does whenCURLOPT_RETURNTRANSFER
isfalse
). Checking for an empty string doesn't distinguish between a failure and a successfulHEAD
request. Checking for the presence of actual response headers is quite cumbersome withext_curl
.Changed the error check in the
Http
adapter too to keep the flow similar with the other adapters.