From f5fc2053847d3054d36d3348d21e7de060342698 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:13:19 +0200 Subject: Add timeout to get tabs request, wait for network online target before booting decky (#239) * Add timeout to tabs get request * Wait for network interfaces to be ready before booting decky --- backend/injector.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backend/injector.py') diff --git a/backend/injector.py b/backend/injector.py index 39b86f9a..82ed6ed4 100644 --- a/backend/injector.py +++ b/backend/injector.py @@ -7,6 +7,7 @@ from typing import List from aiohttp import ClientSession from aiohttp.client_exceptions import ClientConnectorError +from asyncio.exceptions import TimeoutError import uuid BASE_ADDRESS = "http://localhost:8080" @@ -341,12 +342,15 @@ async def get_tabs() -> List[Tab]: while True: try: - res = await web.get(f"{BASE_ADDRESS}/json") + res = await web.get(f"{BASE_ADDRESS}/json", timeout=3) except ClientConnectorError: logger.debug("ClientConnectorError excepted.") logger.debug("Steam isn't available yet. Wait for a moment...") logger.error(format_exc()) await sleep(5) + except TimeoutError: + logger.warn(f"The request to {BASE_ADDRESS}/json timed out") + await sleep(1) else: break -- cgit v1.2.3