Skip to content

Commit d9aac74

Browse files
committed
async too
1 parent 2394b35 commit d9aac74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dkg/providers/node/async_node_http.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def __init__(
3030
endpoint_uri: URI | str,
3131
api_version: str = "v1",
3232
auth_token: str | None = None,
33+
timeout: int = 60, # timeout in seconds
3334
):
3435
super().__init__(endpoint_uri, api_version, auth_token)
36+
self.timeout = timeout
3537

3638
async def make_request(
3739
self,
@@ -42,7 +44,9 @@ async def make_request(
4244
) -> NodeResponseDict:
4345
url = f"{self.url}/{path}"
4446

45-
async with aiohttp.ClientSession() as session:
47+
timeout_config = aiohttp.ClientTimeout(total=self.timeout)
48+
49+
async with aiohttp.ClientSession(timeout=timeout_config) as session:
4650
try:
4751
if method == HTTPRequestMethod.GET:
4852
async with session.get(

0 commit comments

Comments
 (0)