Check specific user account quota usage for Gmail API

末鹿安然 提交于 2020-01-15 12:45:28

问题


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

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:

In the Queries per 100 seconds per user there are no numbers, and the hint from the question mark icon just says: Per user quota usage is not displayed.

From Gmail API Docs we can find :

  • 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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/52542789/check-specific-user-account-quota-usage-for-gmail-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!