dongnaoxia0927 2019-07-19 15:18
浏览 34

如何检查Guzzle 5的进展情况

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效