googleapis / googleapis/google-api-ruby-client
User-rate limit exception/error returns wrong retry-after time, creating forwarding filter not possible
- 主要言語
- Ruby
- スター
- 2.9k
- フォーク
- 888
- 平均マージ
- 6分
- マージ済み PR(30日)
- 218
説明
#### Environment details
- OS: macOS 15.1 (doesn't matter)
- Ruby version: ruby 3.3.6
- Gem name and version: google-apis-gmail_v1 (0.41.0)
#### Steps to reproduce
When creating a Filter via the GMail API (Google::Apis::GmailV1) which includes a forward action, this is apparently user-rate limit throttled.
In my Ruby API client I get the following error messages: rateLimitExceeded: User-rate limit exceeded. Retry after 2024-11-12T11:16:42.247Z (Forwarding rules)
Unfortunately, the time returned when to try again is wrong.
My code waits until this time plus a grace period of 60 seconds. When trying at 11:17:42 UTC I get another rateLimitExceeded: User-rate limit exceeded. Retry after 2024-11-12T11:32:42.968Z (Forwarding rules).
Even when I tried the code a couple of hours later, I still get that error on the first request. So the given retry-after time is clearly wrong.
#### Code example
```ruby
begin
@client = Google::Apis::GmailV1::GmailService.new # Authorization code skipped
criteria = Google::Apis::GmailV1::FilterCriteria.new(…some query…)
action = Google::Apis::GmailV1::FilterAction.new(forward: "test@email.com") # This is a verified address, cross-checked with list_user_setting_forwarding_addresses
filter = Google::Apis::GmailV1::Filter.new(criteria: criteria, action: action)
result = @client.create_user_setting_filter('me', filter_content)
rescue Google::Apis::RateLimitError => e
puts "Rate Limit Exceeded: #{e}
end
> User-rate limit exceeded. Retry after 2024-11-12T11:16:42.247Z (Forwarding rules)
```
コントリビューションガイド
調査の方向性
Google::Apis::GmailV1::GmailService#create_user_setting_filter を使った Gmail フィルターの作成を再現し、Google::Apis::RateLimitError の出力を調査します。報告された Retry after の値に注目してください。クライアントがサービスのレスポンスと一致する再試行時刻を報告すれば完了です。この issue では、ファイルも実行するテストも指定されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ruby
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100