fix: friendly 502 handling, 2 uvicorn workers, file bundle cache (0.20.18)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user