RateExceededError rate limiter is broken

108 views
Skip to first unread message

starrychloe S.

unread,
Dec 9, 2015, 1:45:12 PM12/9/15
to AdWords API Forum

It says to wait 30s. I waited 31s. It still complains. It's single-threaded. 


2015-12-09 18:11:42.944083+00:00 heroku scheduler.5645 - - Starting process with command `php yii kw/stats` Context
2015-12-09 18:11:48.820233+00:00 app scheduler.5645 - - Warning: [RateExceededError <rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30>] Context
2015-12-09 18:11:48.820719+00:00 app scheduler.5645 - - Sleeping 30 seconds. Context
2015-12-09 18:11:43.582785+00:00 heroku scheduler.5645 - - State changed from starting to up Context
2015-12-09 18:12:19.973304+00:00 app scheduler.5645 - - Error: Giving up. [RateExceededError <rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30>] Exception Context
2015-12-09 18:12:20.841574+00:00 heroku scheduler.5645 - - Process exited with status 0 Context
2015-12-09 18:12:20.857147+00:00 heroku scheduler.5645 - - State changed from up to complete Context

Code

      // Make the get request.
      try {
        $retry = false;
        $page = $targetingIdeaService->get($selector);
      } catch (\SoapFault $e) { 
        Yii::error($e->getMessage());
        echo ("Warning: ".$e->getMessage().PHP_EOL);
        $errors = \ErrorUtils::GetApiErrors($e);
        foreach ($errors as $err) {
          if ($err->ApiErrorType == 'RateExceededError' && $err->retryAfterSeconds < 60) {
            echo "Sleeping $err->retryAfterSeconds seconds.\n";
            sleep($err->retryAfterSeconds+1);
            $retry = true;
          }
        }         
        if ($retry) {
          try {
            $page = $targetingIdeaService->get($selector);
          } catch (\SoapFault $e) {
            Yii::error($e->getMessage());
            echo "Error: Giving up. ".$e->getMessage().PHP_EOL;
            exit;
          }
        }
        else {
          echo "Error: Giving up.\n";
          exit;
        }

Anthony Madrigal

unread,
Dec 9, 2015, 4:56:53 PM12/9/15
to AdWords API Forum
Hello,

Are you still experiencing this error? If so, could you please reply privately to author me your SOAP request and response that cause this error?

Thanks,
Anthony
AdWords API Team

starrychloe S.

unread,
Dec 10, 2015, 5:48:48 PM12/10/15
to AdWords API Forum
I don't think that would be possible because it's intermittent and it happens on Heroku which has an ephemeral file system. I know that you can set the API to write the SOAP requests to a file which I seem to remember doing during debugging, but if it writes in production it's not possible to access that file system from another instance. The frequency is about once a week. 

Michael Cloonan (AdWords API Team)

unread,
Dec 14, 2015, 9:21:15 AM12/14/15
to AdWords API Forum
Hello,

When this occurs, do you get the error twice but then execution is fine, or do you repeatedly get this error every time even after waiting the designated number of seconds.

The first case could be normal during times of high usage or based on synchronization issues inherent with Internet traffic. As long as you write your code to wait the specified number of seconds then it should get through after minimal rate limit errors.

If it's the second case, however, then if it's reproducible, I will need as much info as possible including SOAP responses (or at least request IDs) from a recent occurrence and when it happened so that the engineering team can take a closer look.

Regards,
Mike, AdWords API Team
Reply all
Reply to author
Forward
0 new messages