curl hanging and preventing other site requests
Posted: Tue Jun 02, 2009 4:45 pm
I'm using curl to retrieve an xml file, I neglected to put the timeout on curl and noticed when the xml file was unreachable curl would keep trying until the php timeout I guess, but during that time other requests for other files on the site would hang while the curl was processing.
I fixed this by setting a timeout on curl like:
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 4);
I don't really understand what was happening beforehand, does anyone know?
I fixed this by setting a timeout on curl like:
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 4);
I don't really understand what was happening beforehand, does anyone know?