使用ParallelClient报错

pengzhen

问题描述

这里详细描述问题

程序代码

$options = [
            'max_conn_per_addr' => 1000, // 每个域名最多维持多少并发连接
            'keepalive_timeout' => 30,  // 连接多长时间不通讯就关闭
            'connect_timeout'   => 30,  // 连接超时时间
            'timeout'           => 30,  // 请求发出后等待响应的超时时间
        ];
        $http = new \Workerman\Http\ParallelClient( $options );
        $http->push( $url, [ 'data' =>json_encode( $params ), 'headers' =>[ "Content-type: application/json" ] ] );
        $result = $http ->await();

报错信息

Please install revolt/event-loop to use parallel client. in /www/wwwroot/push/vendor/workerman/http-client/src/ParallelClient.php:31

将false改成true后
截图
启动报错

Event loop terminated without resuming the current suspension (the cause is either a fiber deadlock, or an incorrectly unreferenced/canceled watcher): in /www/wwwroot/flowertown-push/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php:145

操作系统及workerman/webman等框架组件具体版本

php8.3
webman v1.5.21

截图

402 1 0
1个回答

walkor 打赏

ParallelClient 是workerman v5的功能,v5还没发布

  • pengzhen 2024-07-24

    啊,那v4能实现类似的功能吗?就是异步发送一组http请求,然后完成后在发送下一组

  • walkor 2024-07-24

    可以,比如弄个计数,每次请求成功或失败计数减一,直到未0

×
🔝