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

Timeout are not correctly respected #402

Open
lyrixx opened this issue Aug 7, 2019 · 0 comments

Comments

@lyrixx
Copy link
Contributor

commented Aug 7, 2019

I created a small reproducer:

I usually get responses in less than 1 secondes (<=100ms actually)
Since the $client->proceed() is executed each seconds, it messes up everything :/

$client = new MultiCurl(new Psr17Factory(), [
    'timeout' => 1,
]);

$client->sendAsyncRequest($a = new Request('GET', 'http://httpbin.org/get'), ['callback' => function($request, $response, $exception) {
    dump([
        'time' => microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'],
        'hasResponse' => $response !== null,
        'hasException' => $exception !== null,
    ]);
}]);

while ($_SERVER['REQUEST_TIME_FLOAT'] + 4 >= microtime(true)) {
    sleep(1);
    $client->proceed();
    echo '.';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.