# HG changeset patch # User Robert Boland # Date 1546609823 18000 # Node ID b1bbf44c701b7c8259fb3492ba731b3cafa0f333 # Parent f024f2f089941574e5c9b0b9ba8058f92bb6ee3f standarise semaphore use diff -r f024f2f08994 -r b1bbf44c701b xml/amazonBookSearch.php --- a/xml/amazonBookSearch.php Fri Jan 04 08:49:25 2019 -0500 +++ b/xml/amazonBookSearch.php Fri Jan 04 08:50:23 2019 -0500 @@ -96,14 +96,20 @@ $gotit=0; $semaphore = new SyncSemaphore("Amazon"); $gotit = $semaphore->lock(1000); - file_put_contents('/var/ywww/debug/phpDebug', - "Got it: ".(int)$gotit." 3\n",FILE_APPEND); - if (!$gotit) { $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) { - usleep(500000); - file_put_contents('/var/ywww/debug/phpDebug',"Unlocking 3\n",FILE_APPEND); $semaphore->unlock(); } + else { + file_put_contents('/var/ywww/debug/phpDebug',"W/o lock 3b\n",FILE_APPEND); + } echo $ret;