Skip to content

Commit 71d0640

Browse files
Fix update when no internet.
1 parent 1de206f commit 71d0640

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/reachy_mini/daemon/app/dashboard/static/js/update.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ const updateManager = {
33
preRelease: false,
44

55
isUpdateAvailable: async () => {
6-
fetch('/update/available?pre_release=' + updateManager.preRelease)
7-
.then(response => response.json())
8-
.then(data => {
6+
await fetch('/update/available?pre_release=' + updateManager.preRelease)
7+
.then(async response => {
8+
if (!response.ok) {
9+
return false;
10+
}
11+
const data = await response.json();
912
return data.update.reachy_mini;
1013
}).catch(error => {
1114
console.error('Error checking for updates:', error);

src/reachy_mini/daemon/app/routers/update.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import threading
88

9+
import requests
910
from fastapi import APIRouter, HTTPException, WebSocket
1011

1112
from reachy_mini.daemon.app import bg_job_register
@@ -29,7 +30,7 @@ def available(pre_release: bool = False) -> dict[str, dict[str, bool]]:
2930
"reachy_mini": is_update_available("reachy_mini", pre_release),
3031
}
3132
}
32-
except ConnectionError:
33+
except (ConnectionError, requests.exceptions.ConnectionError):
3334
raise HTTPException(status_code=503, detail="Unable to check for updates")
3435

3536

0 commit comments

Comments
 (0)