fix: friendly 502 handling, 2 uvicorn workers, file bundle cache (0.20.18)

This commit is contained in:
PTah
2026-06-20 20:01:46 +10:00
parent 4d9a9e7e2b
commit f3a8952947
8 changed files with 63 additions and 40 deletions
+7 -1
View File
@@ -101,6 +101,7 @@ import { useRoute, useRouter } from "vue-router";
import { useSacLiveEventStream } from "../composables/useSacLiveEventStream";
import {
apiFetch,
ApiError,
fetchHost,
fetchRecentEvents,
type HostDetail,
@@ -304,7 +305,7 @@ const sortedItems = computed(() => {
return items;
});
async function loadHosts() {
async function loadHosts(retry = 0) {
loading.value = true;
error.value = "";
try {
@@ -314,6 +315,11 @@ async function loadHosts() {
if (agentStatusFilter.value) params.set("agent_status", agentStatusFilter.value);
data.value = await apiFetch<HostListResponse>(`/api/v1/hosts?${params}`);
} catch (e) {
const status = e instanceof ApiError ? e.status : 0;
if (retry < 2 && (status === 502 || status === 503)) {
await new Promise((resolve) => window.setTimeout(resolve, 2500));
return loadHosts(retry + 1);
}
error.value = e instanceof Error ? e.message : "Ошибка";
} finally {
loading.value = false;