googleapis / googleapis/google-api-ruby-client

User-rate limit exception/error returns wrong retry-after time, creating forwarding filter not possible

Abierto
#20,544 1 comentario 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Ruby
Estrellas
2.9k
Forks
888
Merge medio
6 min
PR fusionados (30 d)
218

Descripción

#### 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)
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce la creación de un filtro de Gmail con Google::Apis::GmailV1::GmailService#create_user_setting_filter e inspecciona la salida de Google::Apis::RateLimitError, centrándote en el valor de Retry after reportado. Se considera terminado cuando el cliente informa de un tiempo de reintento coherente con la respuesta del servicio; el issue no indica ningún archivo ni ninguna prueba que ejecutar.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
ruby
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.