Gmail API错误429 rateLimitExceeded,即使没有任何活动 [英] Gmail API error 429 rateLimitExceeded even where is no any activity

查看:427
本文介绍了Gmail API错误429 rateLimitExceeded,即使没有任何活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与Gmail API集成的NodeJS应用程序. 当我尝试访问Gmail API时,出现此错误:

I have a NodeJS application that integrate with the Gmail API. When I try to access the Gmail API, I get this error:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "rateLimitExceeded",
    "message": "User-rate limit exceeded.  Retry after 2017-03-26T18:15:52.102Z"
   }
  ],
  "code": 429,
  "message": "User-rate limit exceeded.  Retry after 2017-03-26T18:15:52.102Z"
 }
}

我正在等待一段时间,然后重试,并遇到相同的错误. 我等了几个小时,发现API控制台中没有任何活动,再次尝试了该错误,并且出现了相同的错误.

I was wait for period, and try again, and got same error. I was wait for few hours, saw that is no activity in the API console, I was tried again, and got same error.

推荐答案

我认为正在发生的事情是您同时发出太多请求.您可以在 Gmail每用户限制.考虑使用指数补偿.

I think what's happening is you're making too many requests all at the same time. You can see your error in Gmail Per-User Limits. Consider using exponential backoff.

这些是您收到该错误的可能原因:

These are the possible reasons you're getting that error:

并发请求

Gmail API强制执行每个用户的并发请求限制(在 以及每个用户的速率限制).此限制由所有人共享 Gmail API客户端访问给定用户,并确保没有API 客户端超载Gmail用户邮箱或其后端服务器.

The Gmail API enforces a per-user concurrent request limit (in addition to the per-user rate limit). This limit is shared by all Gmail API clients accessing a given user and ensures that no API client is overloading a Gmail user mailbox or their backend server.

对单个用户进行许多并行请求或发送批处理 大量的请求会触发此错误-大量的请求也会触发此错误 访问Gmail用户邮箱的独立API客户端的数量 同时.如果超过此限制,则HTTP 429请求过多 返回对用户的并发请求太多"错误.您的客户 可以使用标准指数补偿重试该请求.

Making many parallel requests for a single user or sending batches with a large number of requests can trigger this error--as can a large number of independent API clients accessing the Gmail user mailbox simultaneously. If this limit is exceeded a HTTP 429 Too Many Requests "Too many concurrent requests for user" error is returned. Your client may retry the request with standard exponential backoff.

由于任何原因都无法提高此每用户限制.

This per-user limit cannot be increased for any reason.

其他原因可能包括:

邮件发送限制

Gmail API强制执行标准的每日邮件发送限制(这些 付费G Suite用户与免费gmail.com用户的限制有所不同.

The Gmail API enforces the standard daily mail sending limits (these limits differ for paying G Suite users vs free gmail.com users).

这些限制是针对每个用户的,并由所有用户的客户端共享, API客户端,本机/Web客户端还是SMTP MSA.如果这些限制 超出HTTP 429太多请求超出用户速率限制" 错误提示(邮件发送)"将返回,并有一段时间重试. 请注意,超出每日限额可能会导致以下类型的 在接受请求之前的多个小时内出现错误,因此您的 客户可以使用标准指数补偿重试该请求.

These limits are per-user and are shared by all of the user's clients, whether API clients, native/web clients or SMTP MSA. If these limits are exceeded a HTTP 429 Too Many Requests "User-rate limit exceeded" error mentioning "(Mail sending)" is returned with a time to retry. Note that daily limits being exceeded may result in these types of errors for multiple hours before the request is accepted, so your client may retry the request with standard exponential backoff.

由于任何原因,不能增加这些每用户限制.

These per-user limits cannot be increased for any reason.

邮件发送管道很复杂:一旦用户超过他们的用户数量, 配额,API开始之前可能会延迟几分钟 返回429个错误响应.所以你不能假设200 回复表示电子邮件已成功发送.

The mail sending pipeline is complex: once the the user exceeds their quota, there can be a delay of several minutes before the API begins to return 429 error responses. So you cannot assume that a 200 response means the email was successfully sent.

带宽限制

API的每用户上传和下载带宽限制为 等于但独立于IMAP.这些限制是相当慷慨的 并在给定用户的所有Gmail API客户端之间共享.

The API has per-user upload and download bandwidth limits that are the equal to, but independent of, IMAP. These limits are quite generous and are shared across all Gmail API clients for a given user.

这些限制通常仅在异常或滥用中达到 情况.如果超出了这些限制,则HTTP 429请求过多 返回超出用户速率限制"错误,并有一段时间重试. 请注意,超出每日限额可能会导致以下类型的 在接受请求之前的多个小时内出现错误,因此您的 客户可以使用标准指数补偿重试该请求.

These limits are typically only hit in exceptional or abusive situations. If these limits are exceeded a HTTP 429 Too Many Requests "User-rate limit exceeded" error is returned with a time to retry. Note that daily limits being exceeded may result in these types of errors for multiple hours before the request is accepted, so your client may retry the request with standard exponential backoff.

由于任何原因,不能增加这些每用户限制.

These per-user limits cannot be increased for any reason.

这篇关于Gmail API错误429 rateLimitExceeded,即使没有任何活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆