# HG changeset patch # User Charlie Root # Date 1546642940 18000 # Node ID c24ae74bf6d54725e2909d2891e360efdb2c73b4 # Parent 633402a4995d5e0a9e9ffe176c17888d7eaed560 pass char for log lines in to doAmazonRequest diff -r 633402a4995d -r c24ae74bf6d5 php/read/getBookDetails.php --- 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; diff -r 633402a4995d -r c24ae74bf6d5 xml/doAmazonRequest.inc --- 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 @@ 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");