Skip to content

Commit 8480e7a

Browse files
Retry aiohttp requests on asyncio.TimeoutError (#701)
1 parent f4fdfb7 commit 8480e7a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].
66

7+
## [Unreleased]
8+
9+
### Fixed
10+
11+
- http: Mark `asyncio.TimeoutError` exception as safe to retry.
12+
713
## [6.5.6] - 2022-05-02
814

915
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ We are grateful to all the people who help us with the project.
6060
- [@sbihel](https://github.com/sbihel)
6161
- [@tezosmiami](https://github.com/tezosmiami)
6262
- [@tomsib2001](https://github.com/tomsib2001)
63+
- [@TristanAllaire](https://github.com/TristanAllaire)
6364
- [@veqtor](https://github.com/veqtor)
6465
- [@xflpt](https://github.com/xflpt)
6566

src/dipdup/http.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
from dipdup.exceptions import InvalidRequestError
2727
from dipdup.prometheus import Metrics
2828

29-
safe_exceptions = (
29+
exceptions_to_retry = (
3030
aiohttp.ClientConnectionError,
3131
aiohttp.ClientConnectorError,
3232
aiohttp.ClientResponseError,
3333
aiohttp.ClientPayloadError,
34+
# NOTE: aiohttp doesn't reraise it
35+
asyncio.TimeoutError,
3436
)
3537

3638

@@ -149,7 +151,7 @@ async def _retry_request(
149151
weight=weight,
150152
**kwargs,
151153
)
152-
except safe_exceptions as e:
154+
except exceptions_to_retry as e:
153155
if self._config.retry_count and attempt - 1 == self._config.retry_count:
154156
raise e
155157

0 commit comments

Comments
 (0)