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]);
|
||||
}
|
||||
|
||||
//send the requests
|
||||
do {
|
||||
$returnVal = curl_multi_exec($cmh, $runningHandles);
|
||||
} while ($returnVal == CURLM_CALL_MULTI_PERFORM);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}while($runningHandles > 0);
|
||||
|
||||
|
||||
//Get results
|
||||
for ($i = 0; $i < count($iasUrls); $i++){
|
||||
|
|
|
@ -105,12 +105,9 @@ function play(gameId,xd_check){
|
|||
drawMap(reponse['lap']);
|
||||
if(reponse['continue'] == '1'){
|
||||
|
||||
setTimeout(function(){
|
||||
//setTimeout(function(){
|
||||
play(gameId,xd_check);
|
||||
} ,500);
|
||||
|
||||
|
||||
|
||||
//} ,500);
|
||||
|
||||
}else{
|
||||
alert ('game ended');
|
||||
|
|
Loading…
Reference in New Issue
Block a user