Skip to content

Commit dd4069a

Browse files
committed
Merge branch 'shorten-timeout'
2 parents d755ba6 + dd2fa29 commit dd4069a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

recuair_cli/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import httpx
3535
from bs4 import BeautifulSoup, PageElement, Tag
3636
from docopt import docopt
37-
from tenacity import retry, stop_after_attempt, wait_exponential
37+
from tenacity import retry, stop_after_attempt, wait_fixed
3838

3939
from recuair_cli import __version__
4040

@@ -89,7 +89,7 @@ def _int_or_none(value: str) -> Optional[int]:
8989
async def get_status(client: httpx.AsyncClient, device: str) -> Status:
9090
"""Return device status."""
9191
try:
92-
response = await client.get(f"http://{device}/", timeout=3)
92+
response = await client.get(f"http://{device}/", timeout=1)
9393
response.raise_for_status()
9494
except httpx.HTTPError as error:
9595
_LOGGER.debug("Error encountered: %s", error)
@@ -160,7 +160,7 @@ async def post_request(client: httpx.AsyncClient, device: str, data: dict[str, A
160160

161161
# XXX: Add retry, recuair devices are often irresponsive.
162162
def _wrap_retry(func: Callable[..., X]) -> Callable[..., X]:
163-
return retry(reraise=True, stop=stop_after_attempt(10), wait=wait_exponential(max=30))(func)
163+
return retry(reraise=True, stop=stop_after_attempt(20), wait=wait_fixed(1))(func)
164164

165165

166166
async def _run(options: dict[str, str]) -> None: # noqa: C901

0 commit comments

Comments
 (0)