diff options
| author | suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> | 2022-10-30 00:13:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-29 15:13:19 -0700 |
| commit | f5fc2053847d3054d36d3348d21e7de060342698 (patch) | |
| tree | e6adce53f62cc267076669720c5afecaf7ba18c3 | |
| parent | 4d30339c34782a6e3d313804fa393c95ad38c4b2 (diff) | |
| download | decky-loader-f5fc2053847d3054d36d3348d21e7de060342698.tar.gz decky-loader-f5fc2053847d3054d36d3348d21e7de060342698.zip | |
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
| -rw-r--r-- | backend/injector.py | 6 | ||||
| -rw-r--r-- | dist/install_prerelease.sh | 2 | ||||
| -rw-r--r-- | dist/install_release.sh | 2 |
3 files changed, 9 insertions, 1 deletions
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 diff --git a/dist/install_prerelease.sh b/dist/install_prerelease.sh index cdab980a..8b9be30e 100644 --- a/dist/install_prerelease.sh +++ b/dist/install_prerelease.sh @@ -30,6 +30,8 @@ rm -f "/etc/systemd/system/plugin_loader.service" cat > "/etc/systemd/system/plugin_loader.service" <<- EOM [Unit] Description=SteamDeck Plugin Loader +After=network-online.target +Wants=network-online.target [Service] Type=simple User=root diff --git a/dist/install_release.sh b/dist/install_release.sh index 3656e10e..f4f1f91d 100644 --- a/dist/install_release.sh +++ b/dist/install_release.sh @@ -30,6 +30,8 @@ rm -f "/etc/systemd/system/plugin_loader.service" cat > "/etc/systemd/system/plugin_loader.service" <<- EOM [Unit] Description=SteamDeck Plugin Loader +After=network-online.target +Wants=network-online.target [Service] Type=simple User=root |
