I use Guzzle 5 to get data from api and insert into database. After run this php code I use another ajax call which get's current progress. The problem is that ajax call return value after script finish. So it is always 100%. Is there a way I can get insert progress ?
$client = new GuzzleHttp\Client([
'base_url' => $domain
]);
$params = [];
$requests[] = $client->createRequest('GET', '?' . http_build_query($params));
GuzzleHttp\Pool::send($client, $requests, [
'pool_size' => 10,
'complete' => function (CompleteEvent $event) {
$this->insertData();
}
},
'error' => function (ErrorEvent $event) {
$this->handleError($error);
}
]);
It look like database is busy that's why I can't get progress data which I store in database.