Skip to content
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

How to catch exceptions in bulk request sending? #206

Open
Coding-Yuan opened this issue May 25, 2020 · 0 comments
Open

How to catch exceptions in bulk request sending? #206

Coding-Yuan opened this issue May 25, 2020 · 0 comments
Labels
type:enhancement Enhancement

Comments

@Coding-Yuan
Copy link

Coding-Yuan commented May 25, 2020

What steps will reproduce the problem?

In bulk request sending, when a request fails, the response cannot be obtained. When one request fails, how do other requests return correctly?

use yii\httpclient\Client;

$client = new Client();

$requests = [
    $client->get('http://domain.com/keep-alive'),
    $client->post('http://domain.com/notify', ['userId' => 12]),
];
$responses = $client->batchSend($requests);

What's expected?

In batch requests, not only some requests fail, but also other requests return correctly

What do you get instead?

If there is a request timeout in batch request sending, an exception is responded

Additional info

Q A
Yii version 2.0.35
Yii HTTP Client version ^2.0
PHP version 7.1.31
Operating system CentOS7.6
@yii-bot yii-bot closed this as completed May 25, 2020
@yiisoft yiisoft deleted a comment from yii-bot May 25, 2020
@samdark samdark reopened this May 25, 2020
@samdark samdark added type:enhancement Enhancement and removed question labels May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants