fix(update): recover from stalled panel self-update instead of hanging at 80%
The panel update status lived only in-memory and was cleared solely by the host watchdog restarting the container. If the rebuild failed mid-way (e.g. the build OOMs the host when no swap is configured), the container never restarted and the UI stayed at "restarting - 80%" forever. - update_service: get_update_status() now self-heals — after UPDATE_TIMEOUT_SECONDS (default 900s) of "is_updating" it transitions to a terminal "failed" state with a clear error pointing at the host update service / logs. - use-settings: poll update status while the server reports is_updating (not only right after the click in the same tab), so reloading a stuck page keeps refreshing. - SettingsPage: banner now renders the "failed" state with the error message. - update_host.sh: build images sequentially (app, then frontend) to lower peak memory and avoid the OOM that killed the build mid-run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -668,11 +668,24 @@ function AboutTab() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Update in progress banner */}
|
||||
{status?.is_updating && (
|
||||
<div className="rounded-md border border-warning/40 bg-warning/10 p-3 text-sm">
|
||||
<p className="font-medium">{t('settings.update_in_progress')}</p>
|
||||
<p className="text-xs text-muted-foreground">{status.stage} — {status.progress}%</p>
|
||||
{/* Update in progress / failed banner */}
|
||||
{status && (status.is_updating || status.stage === 'failed' || status.error) && (
|
||||
<div className={`rounded-md border p-3 text-sm ${
|
||||
status.stage === 'failed' || status.error
|
||||
? 'border-destructive/40 bg-destructive/10'
|
||||
: 'border-warning/40 bg-warning/10'
|
||||
}`}>
|
||||
{status.stage === 'failed' || status.error ? (
|
||||
<>
|
||||
<p className="font-medium text-destructive">{t('settings.update_failed')}</p>
|
||||
{status.error && <p className="mt-1 text-xs text-muted-foreground">{status.error}</p>}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="font-medium">{t('settings.update_in_progress')}</p>
|
||||
<p className="text-xs text-muted-foreground">{status.stage} — {status.progress}%</p>
|
||||
</>
|
||||
)}
|
||||
<Button size="sm" variant="ghost" className="mt-2" onClick={() => resetUpdate.mutate()} disabled={resetUpdate.isPending}>
|
||||
{t('settings.update_reset')}
|
||||
</Button>
|
||||
|
||||
@@ -217,7 +217,12 @@ export function useUpdateStatus(poll = false) {
|
||||
return useQuery({
|
||||
queryKey: settingsKeys.updateStatus,
|
||||
queryFn: () => apiClient.get<UpdateStatus>('/settings/api/updates/status'),
|
||||
refetchInterval: poll ? 3000 : false,
|
||||
// Poll while an update is actually running (server-driven), so a page reload
|
||||
// on a stuck update keeps refreshing until it succeeds or times out — not
|
||||
// only right after the user clicked "Update" in this tab. `poll` starts the
|
||||
// loop immediately after clicking, before the first status arrives.
|
||||
refetchInterval: (query) =>
|
||||
poll || query.state.data?.is_updating ? 3000 : false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1324,6 +1324,7 @@
|
||||
"update_confirm": "Start the update? The panel will pull the latest version, rebuild and restart — it will be briefly unavailable.",
|
||||
"update_started": "Update started",
|
||||
"update_in_progress": "Update in progress",
|
||||
"update_failed": "Update failed",
|
||||
"update_reset": "Reset status",
|
||||
"send_test": "Send test",
|
||||
"test_email_placeholder": "test@example.com",
|
||||
|
||||
@@ -1324,6 +1324,7 @@
|
||||
"update_confirm": "Запустить обновление? Панель скачает последнюю версию, пересоберётся и перезапустится — на короткое время будет недоступна.",
|
||||
"update_started": "Обновление запущено",
|
||||
"update_in_progress": "Идёт обновление",
|
||||
"update_failed": "Обновление не удалось",
|
||||
"update_reset": "Сбросить статус",
|
||||
"send_test": "Тест",
|
||||
"test_email_placeholder": "test@example.com",
|
||||
|
||||
Reference in New Issue
Block a user