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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试