Mercurial > hg > ywww
diff xml/amazonBookSearch.php @ 42:3f400072bf14
merge, involved ediff3 wrt getAmazonInfo.php
| author | Charlie Root |
|---|---|
| date | Sat, 05 Jan 2019 06:21:12 -0500 |
| parents | b1bbf44c701b |
| children | dbc006408d2b |
line wrap: on
line diff
--- a/xml/amazonBookSearch.php Sun Jul 30 05:36:48 2017 -0400 +++ b/xml/amazonBookSearch.php Sat Jan 05 06:21:12 2019 -0500 @@ -93,6 +93,23 @@ curl_setopt ($crl, CURLOPT_ENCODING , "gzip"); 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." 3\n",FILE_APPEND); + $gotit=$semaphore->lock(1000); + file_put_contents('/var/ywww/debug/phpDebug', + "Got it: ".(int)$gotit." 3a\n",FILE_APPEND); + } $ret = curl_exec($crl); curl_close($crl); + usleep(500000); + if ($gotit) { + $semaphore->unlock(); + } + else { + file_put_contents('/var/ywww/debug/phpDebug',"W/o lock 3b\n",FILE_APPEND); + } echo $ret;
