Mercurial > hg > ywww
changeset 38:c24ae74bf6d5
pass char for log lines in to doAmazonRequest
author | Charlie Root |
---|---|
date | Fri, 04 Jan 2019 18:02:20 -0500 |
parents | 633402a4995d |
children | 2c0c95bd97a6 |
files | php/read/getBookDetails.php xml/doAmazonRequest.inc |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/php/read/getBookDetails.php Fri Jan 04 14:05:23 2019 -0500 +++ b/php/read/getBookDetails.php Fri Jan 04 18:02:20 2019 -0500 @@ -188,7 +188,7 @@ } try { - $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3); + $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,6,'d'); //use this xml to pull out the necessary information and save it set_error_handler(function () { global $out,$isbn;
--- a/xml/doAmazonRequest.inc Fri Jan 04 14:05:23 2019 -0500 +++ b/xml/doAmazonRequest.inc Fri Jan 04 18:02:20 2019 -0500 @@ -1,6 +1,6 @@ <?php -function doAmazonRequest($ext, $parameters, $try) +function doAmazonRequest($ext, $parameters, $try, $dbl='x') { $public_key ="AKIAIHTNWC7L6LOUY4LQ"; $private_key="zWQlIzndJDtXNfxEXH7K7YR7hzv3u77lOcqfqPde"; @@ -26,10 +26,10 @@ $gotit = $semaphore->lock(1000); if (!$gotit) { file_put_contents('/var/ywww/debug/phpDebug', - "Got it: ".(int)$gotit." $requestIP 1\n",FILE_APPEND); + "Got it: ".(int)$gotit." $requestIP $dbl\n",FILE_APPEND); $gotit=$semaphore->lock(1000); file_put_contents('/var/ywww/debug/phpDebug', - "Got it: ".(int)$gotit." $requestIP 1a\n",FILE_APPEND); + "Got it: ".(int)$gotit." $requestIP $dbl"."a\n",FILE_APPEND); } $output = curl_exec($crl); //file_put_contents('/var/ywww/debug/phpDebug', @@ -42,7 +42,7 @@ } else { file_put_contents('/var/ywww/debug/phpDebug', - "W/o lock for $requestIP 1b\n",FILE_APPEND); + "W/o lock for $requestIP $dbl"."b\n",FILE_APPEND); } $mm=array(); $xml = new SimpleXMLElement($output); @@ -56,7 +56,7 @@ $code=$xml->Items->Request->Errors->Error->Code; $message=$xml->Items->Request->Errors->Error->Message; } - file_put_contents('/var/ywww/debug/phpDebug',"Losing $i: ".$mm[0].", $resName, $code, $requestIP, $requestURI\n",FILE_APPEND); + file_put_contents('/var/ywww/debug/phpDebug',"Losing $i: $dbl ".$mm[0].", $resName, $code, $requestIP, $requestURI\n",FILE_APPEND); if ($code!='RequestThrottled') { file_put_contents('/var/ywww/debug/phpDebug',"message: $message\n",FILE_APPEND); if ($code=='AWS.InvalidParameterValue' && strpos($message,"for ItemId.")>0) { @@ -69,7 +69,7 @@ $parameters['Keywords']=urlencode($isbnMaybe); } file_put_contents('/var/ywww/debug/phpDebug',"retrying with $isbnMaybe\n",FILE_APPEND); - return doAmazonRequest($ext,$parameters,$try); + return doAmazonRequest($ext,$parameters,$try,$dbl); } } if ($code=="") { @@ -81,7 +81,7 @@ else { return $xml; } - usleep(200000); // Try to reduce throttling until we get a + usleep(100000*$i); // Try to reduce throttling until we get a // principled solution in place } throw new Exception("ThrottledRepeatedly");