Mercurial > hg > ywww
diff php/read/similar.php @ 42:3f400072bf14
merge, involved ediff3 wrt getAmazonInfo.php
| author | Charlie Root |
|---|---|
| date | Sat, 05 Jan 2019 06:21:12 -0500 |
| parents | d606320ec331 |
| children | d9dd9705e724 |
line wrap: on
line diff
--- a/php/read/similar.php Sun Jul 30 05:36:48 2017 -0400 +++ b/php/read/similar.php Sat Jan 05 06:21:12 2019 -0500 @@ -106,8 +106,26 @@ curl_setopt ($crl, CURLOPT_URL,$url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); + $gotit=0; + $semaphore = new SyncSemaphore("Amazon"); + $gotit = $semaphore->lock(1000); + if (!$gotit) { + file_put_contents('/var/ywww/debug/phpDebug', + "Got it: ".(int)$gotit." 4\n",FILE_APPEND); + $gotit = $semaphore->lock(1000); + file_put_contents('/var/ywww/debug/phpDebug', + "Got it: ".(int)$gotit." 4a\n",FILE_APPEND); + } $ret = curl_exec($crl); curl_close($crl); + usleep(500000); + if ($gotit) { + $semaphore->unlock(); + } + else { + file_put_contents('/var/ywww/debug/phpDebug', + "Unlocking 4\n",FILE_APPEND); + } //echo $ret; $xml = new SimpleXMLElement($ret);
