Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyc60 committed Jul 4, 2023
1 parent 6c9e449 commit 3a57fc6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sw_utils/consensus.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import logging
from enum import Enum
from typing import Any
Expand Down Expand Up @@ -70,7 +71,10 @@ async def _async_make_get_request(self, endpoint_uri: str) -> dict[str, Any]:
except AiohttpRecoveredErrors as error:
if i == len(self.base_urls) - 1:
raise error
logger.error(error)
if isinstance(error, asyncio.TimeoutError):
logger.error('%s: asyncio.TimeoutError', url)
else:
logger.error('%s: %s', url, error)

return {}

Expand Down
6 changes: 5 additions & 1 deletion sw_utils/execution.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import logging
from typing import Any

Expand Down Expand Up @@ -30,7 +31,6 @@ def __init__(
endpoint_urls: list[str],
request_kwargs: Any | None = None,
):
logger.debug({'msg': 'Initialize MultiHTTPProvider'})
self._endpoint_urls = endpoint_urls
self._providers = []

Expand All @@ -55,6 +55,10 @@ async def make_request(self, method: RPCEndpoint, params: Any) -> RPCResponse:
if i == len(self._providers) - 1:
raise error
logger.error(error)
if isinstance(error, asyncio.TimeoutError):
logger.error('%s: asyncio.TimeoutError', provider.endpoint_uri)
else:
logger.error('%s: %s', provider.endpoint_uri, error)

return {}

Expand Down

0 comments on commit 3a57fc6

Please sign in to comment.