resolve the 100% CPU curl multi
This commit is contained in:
parent
0fb60e7cf4
commit
759230082c
|
@ -1 +1 @@
|
||||||
1660
|
1662
|
|
@ -181,21 +181,12 @@ class TronGame
|
||||||
);
|
);
|
||||||
curl_multi_add_handle($cmh,$ch[$i]);
|
curl_multi_add_handle($cmh,$ch[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//send the requests
|
//send the requests
|
||||||
do {
|
do {
|
||||||
$returnVal = curl_multi_exec($cmh, $runningHandles);
|
$returnVal = curl_multi_exec($cmh, $runningHandles);
|
||||||
} while ($returnVal == CURLM_CALL_MULTI_PERFORM);
|
}while($runningHandles > 0);
|
||||||
// Loop and continue processing the request
|
|
||||||
while ($runningHandles && $returnVal== CURLM_OK) {
|
|
||||||
// Wait forever for network
|
|
||||||
$numberReady = curl_multi_select($cmh);
|
|
||||||
if ($numberReady != -1) {
|
|
||||||
// Pull in any new data, or at least handle timeouts
|
|
||||||
do {
|
|
||||||
$returnVal = curl_multi_exec($cmh, $runningHandles);
|
|
||||||
} while ($returnVal == CURLM_CALL_MULTI_PERFORM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get results
|
//Get results
|
||||||
for ($i = 0; $i < count($iasUrls); $i++){
|
for ($i = 0; $i < count($iasUrls); $i++){
|
||||||
|
|
|
@ -105,12 +105,9 @@ function play(gameId,xd_check){
|
||||||
drawMap(reponse['lap']);
|
drawMap(reponse['lap']);
|
||||||
if(reponse['continue'] == '1'){
|
if(reponse['continue'] == '1'){
|
||||||
|
|
||||||
setTimeout(function(){
|
//setTimeout(function(){
|
||||||
play(gameId,xd_check);
|
play(gameId,xd_check);
|
||||||
} ,500);
|
//} ,500);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
alert ('game ended');
|
alert ('game ended');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user