Open
Description
I converted my timings collector (based on LogHttpArchive) to the new events system and requestEnd() doesn't get called when the last request has finished.
$client = (new Amp\Http\Client\HttpClientBuilder)
->usingPool(Amp\Http\Client\Connection\ConnectionLimitingPool::byAuthority(4))
->listen(new HttpRequestTimings)
->build();
$semaphore = new Amp\Sync\LocalSemaphore(4);
$futures = [];
foreach ($urls as $url) {
$futures[] = async(function () use ($client, $semaphore, $url) {
$request = new Request($url);
$lock = $semaphore->acquire();
$response = $client->request($request)->getBody()->buffer();
$lock->release();
});
}
await($futures);
At this stage requestEnd() has not been called.
However if I add \Amp\delay(0)
after await($futures)
, then requestEnd() is called.
Is this as intended? Should I somehow await for the HTTP client to finish?
Metadata
Metadata
Assignees
Labels
No labels