本文介绍了检查Gmail API的特定用户帐户配额使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在使用Gmail API .NET客户端发送/获取电子邮件.

I'm using Gmail API .NET client to send/get emails.

最近,对于一些gmail帐户,无论是发送/获取电子邮件,我都开始收到此消息的异常:

Recently I started getting exceptions with this message for some gmail accounts, for both sending/getting emails:

Google.Apis.Requests.RequestError
User-rate limit exceeded.  Retry after 2018-09-25T13:31:30.444Z [429]
Errors [
    Message[User-rate limit exceeded.  Retry after 2018-09-25T13:31:30.444Z] Location[ - ] Reason[rateLimitExceeded] Domain[usageLimits]
]

我想知道是否可以在控制台中查看特定帐户的项目的每用户配额使用情况,

I'd like to know if it's possible to check a per-user quota usage for my project for a specific account, in the console I found this:

Gmail API文档中,我们可以找到:

  • 每位用户的速率限制:每位用户每秒250个配额单位,移动平均值(允许短暂爆发)
  • messages.send方法消耗100个配额单位
  • messages.get方法消耗5个配额单位
  • messages.list方法消耗5个配额单位
  • messages.attachments.get方法消耗5个配额单位
  • Per User-rate limit: 250 quota units per user per second, moving average (allows short bursts)
  • messages.send method consumes 100 quota units
  • messages.get method consumes 5 quota units
  • messages.list method consumes 5 quota units
  • messages.attachments.get method consumes 5 quota units

我认为我无法为任何用户达到每秒250个配额单位,但我想确定并在Google控制台上针对特定用户帐户进行检查.有可能吗?

I don't think I'm reaching 250 quota units per second for any user, yet I'd like to make sure and check that on Google Console for a specific user account. Is that possible?

我听说过指数回退,如果您确实打了很多电话,这很适合.就我而言,我不应该打很多电话,所以我想对此进行调查并解决,而不是仅仅实施回退.

I've heard of exponential backoff, which is suitable if you indeed make many calls. In my case, I shouldn't be making many calls, so I'd like to investigate that and fix, rather than just implementing a backoff.

推荐答案

控制台没有说出每个用户的配额使用情况,因为每个用户的配额使用情况都不一样-列出每个用户的配额使用情况没有意义

The console doesn't say the per-user quota usage because it is different for every user - it doesn't make sense to list every single user's quota usage.

建议采用指数补偿.不仅可以将您的使用限制到速率限制,而且还是处理服务器端错误的正确方法.

Exponential back-off is recommended. Not only does it allow your usage to be throttled to the rate limit, but it also is the correct way to handle server-side errors.

这篇关于检查Gmail API的特定用户帐户配额使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 16:56