Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Fix the Settings configuration

lotk103d1d849c8c
diff --git a/core/internal/controller/settings/settings_v1_set_system_config_key.go b/core/internal/controller/settings/settings_v1_set_system_config_key.go
index a42350fd..65f53890 100644
--- a/core/internal/controller/settings/settings_v1_set_system_config_key.go
+++ b/core/internal/controller/settings/settings_v1_set_system_config_key.go
@@ -2,6 +2,8 @@ package settings
import (
"context"
+ "github.com/gogf/gf/os/gtimer"
+ "time"
"billionmail-core/api/settings/v1"
"billionmail-core/internal/service/public"
@@ -40,12 +42,14 @@ func (c *ControllerV1) SetSystemConfigKey(ctx context.Context, req *v1.SetSystem
}
// 4. Restart the container
- g.Log().Info(ctx, public.LangCtx(ctx, "Configuration updated, preparing to restart container"))
- err = public.DockerApiFromCtx(ctx).RestartContainerByName(ctx, "billionmail-core-billionmail-1")
- if err != nil {
- res.SetError(gerror.New(public.LangCtx(ctx, "Failed to restart container: {}", err)))
- return res, nil
- }
+ gtimer.AddOnce(500*time.Millisecond, func() {
+ err = public.DockerApiFromCtx(ctx).RestartContainerByName(ctx, "billionmail-core-billionmail-1")
+ if err != nil {
+ g.Log().Error(ctx, "Failed to restart container: {}", err)
+ return
+ }
+
+ })
res.SetSuccess(public.LangCtx(ctx, "Configuration updated successfully"))
return res, nil