<?php
require __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
$worker = new Worker();
$worker->onWorkerStart = function(){
$http = new Workerman\Http\Client();
for ($i=0; $i < 10000; $i++) {
if(/*这里我想判断正在执行的异步任务没超过256个*/) sleep(1);
$http->get('http://example.com/', function($response){
var_dump($response->getStatusCode());
echo $response->getBody();
}, function($exception){
echo $exception;
});
}
};
Worker::runAll();
请教下这里我怎么判断异步的任务没有超过256个啊,超过了就爆
system call select exceeded the maximum number of connections 256
for ($i=0; $i < 250; $i++) {
}
我有超过250的链接要请求的啊