mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +00:00
Fix retry
This commit is contained in:
@@ -4,7 +4,6 @@ import { useEnvContext } from "./useEnvContext";
|
|||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
GetDockerStatusResponse,
|
GetDockerStatusResponse,
|
||||||
GetSiteResponse,
|
|
||||||
ListContainersResponse,
|
ListContainersResponse,
|
||||||
TriggerFetchResponse
|
TriggerFetchResponse
|
||||||
} from "@server/routers/site";
|
} from "@server/routers/site";
|
||||||
@@ -89,16 +88,13 @@ export function useDockerSocket(site: Site) {
|
|||||||
AxiosResponse<ListContainersResponse>
|
AxiosResponse<ListContainersResponse>
|
||||||
>(`/site/${site.siteId}/docker/containers`);
|
>(`/site/${site.siteId}/docker/containers`);
|
||||||
setContainers(res.data.data);
|
setContainers(res.data.data);
|
||||||
return;
|
return res.data.data;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
attempt++;
|
attempt++;
|
||||||
|
|
||||||
// Check if the error is a 425 (Too Early) status
|
// Check if the error is a 425 (Too Early) status
|
||||||
if (error?.response?.status === 425) {
|
if (error?.response?.status === 425) {
|
||||||
if (attempt < maxRetries) {
|
if (attempt < maxRetries) {
|
||||||
// Ask the newt server to check containers
|
|
||||||
await fetchContainerList();
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Containers not ready yet (attempt ${attempt}/${maxRetries}). Retrying in 250ms...`
|
`Containers not ready yet (attempt ${attempt}/${maxRetries}). Retrying in 250ms...`
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user