title: GMailApp.search user-rate limit exceeded
body: <p>I'm running GmailApp.search to find un-labeled email, classify it, and then label it if it matches various rules.  The script triggers every 10 minutes, but is getting 'user-rate limit exceeded' warnings.  Below is the GmailApp search I'm running.  Typically I only have less than 100 unlabeled emails in my inbox, so I wouldn't expect this would take a lot of resources if the search is in any way efficient.  </p>
  
  <pre><code>function RunRules()
  {
      var threads = GmailApp.search("label:inbox has:nouserlabels");
      if (threads.length &gt; 0)
      {
        for (var idxThread=threads.length-1; idxThread&gt;=0; idxThread--)
        {
          var messages = threads[idxThread].getMessages();
          if (messages) 
          {
            for (var idxMsg=messages.length-1; idxMsg&gt;=0; idxMsg--)
            {
  
              if (messages[idxMsg].isInInbox())
              {
                RunRulesOnMessage(messages[idxMsg]);
              }
            }
          }
        }
      }
  }
  </code></pre>
  
  <p>Any suggestions how to avoid the user-rate limit?</p>
  
  <p>Thanks,
  Dave</p>