fix: Increase Docker restart timeout duration (#10447)

Refs #10440
This commit is contained in:
ssongliu 2025-09-23 11:58:04 +08:00 committed by GitHub
parent 0138d481a6
commit 1d54dcc95c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View file

@ -8,6 +8,7 @@ import (
"os"
"path"
"strings"
"time"
"github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant"
@ -457,7 +458,7 @@ func restartDocker() error {
if err != nil {
return err
}
stdout, err := cmd.RunDefaultWithStdoutBashCf("%s restart docker", restartCmd)
stdout, err := cmd.NewCommandMgr(cmd.WithTimeout(3*time.Minute)).RunWithStdoutBashCf("%s restart docker", restartCmd)
if err != nil {
return fmt.Errorf("failed to restart Docker: %s", stdout)
}

View file

@ -185,7 +185,7 @@ export const composeUpdate = (params: Container.ComposeUpdate) => {
// docker
export const dockerOperate = (operation: string) => {
return http.post(`/containers/docker/operate`, { operation: operation });
return http.post(`/containers/docker/operate`, { operation: operation }, TimeoutEnum.T_3M);
};
export const loadDaemonJson = () => {
return http.get<Container.DaemonJsonConf>(`/containers/daemonjson`);
@ -197,18 +197,18 @@ export const loadDockerStatus = () => {
return http.get<Container.DockerStatus>(`/containers/docker/status`);
};
export const updateDaemonJson = (key: string, value: string) => {
return http.post(`/containers/daemonjson/update`, { key: key, value: value }, TimeoutEnum.T_60S);
return http.post(`/containers/daemonjson/update`, { key: key, value: value }, TimeoutEnum.T_3M);
};
export const updateLogOption = (maxSize: string, maxFile: string) => {
return http.post(`/containers/logoption/update`, { logMaxSize: maxSize, logMaxFile: maxFile }, TimeoutEnum.T_60S);
return http.post(`/containers/logoption/update`, { logMaxSize: maxSize, logMaxFile: maxFile }, TimeoutEnum.T_3M);
};
export const updateIpv6Option = (fixedCidrV6: string, ip6Tables: boolean, experimental: boolean) => {
return http.post(
`/containers/ipv6option/update`,
{ fixedCidrV6: fixedCidrV6, ip6Tables: ip6Tables, experimental: experimental },
TimeoutEnum.T_60S,
TimeoutEnum.T_3M,
);
};
export const updateDaemonJsonByfile = (params: Container.DaemonJsonUpdateByFile) => {
return http.post(`/containers/daemonjson/update/byfile`, params);
return http.post(`/containers/daemonjson/update/byfile`, params, TimeoutEnum.T_3M);
};

View file

@ -20,6 +20,7 @@ export enum ResultEnum {
export enum TimeoutEnum {
T_40S = 40000,
T_60S = 60000,
T_3M = 180000,
T_5M = 300000,
T_10M = 600000,
T_1H = 3600000,