Retry decorator on RateLimitExceeded issue
- Lenguaje dominante
- Python
- Estrellas
- 2.1k
- Forks
- 931
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 4
Descripción
## Summary
Enabling retry logic does not work for rate limit exceeded responses.
## Detailed Information
retry decorator expects a `RateLimitExceeded` error to be raised, though `session.request` method does not raise an exception if a response is returned by the server no matter the status code.
I've tested it on azure_arm driver by setting `RETRY_FAILED_HTTP_REQUESTS` to True and trying:
```python
while True:
nodes = driver.list_nodes()
print(nodes)
```
Hitting the throttling limit results in:
```python
Traceback (most recent call last):
File "test.py", line 23, in
nodes = driver.list_nodes()
File "/home/dimgal/libcloud/libcloud/compute/drivers/azure_arm.py", line 395, in list_nodes
r = self.connection.request(action,
File "/home/dimgal/libcloud/libcloud/common/azure_arm.py", line 227, in request
return super(AzureResourceManagementConnection, self) \
File "/home/dimgal/libcloud/libcloud/common/base.py", line 655, in request
response = responseCls(**kwargs)
File "/home/dimgal/libcloud/libcloud/common/base.py", line 165, in __init__
raise exception_from_message(code=self.status,
libcloud.common.exceptions.RateLimitReachedError: 429 Rate limit exceeded
```
urllib3 supports [retries](https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry) based on HTTP status codes, maybe use this? Let me know how you think this should be handled
Guía de contribución
Línea de trabajo
Empieza siguiendo el decorador de reintentos y el flujo de solicitudes en libcloud/common/base.py; después compara la ruta de Azure ARM en libcloud/common/azure_arm.py con la llamada al controlador azure_arm mostrada en el informe. Reproduce el caso de límite de tasa configurado y determina cómo un 429 devuelto se convierte en RateLimitReachedError. Se considera terminado cuando el comportamiento de reintento funciona para las respuestas de límite de tasa al habilitar la lógica de reintentos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend, cloud
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100