优化结构
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"kra/internal/biz/system"
|
||||
"log/slog"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -138,6 +139,14 @@ func (h *Public) InitializeDatabase(engine *gin.Engine) gin.HandlerFunc {
|
||||
values = append(values, dto.Route{Path: route.Path, Method: route.Method})
|
||||
}
|
||||
if err := h.system.InitializeRoutes(c.Request.Context(), &input, values); err != nil {
|
||||
// Database activation is already committed before the scheduler reload
|
||||
// runs. GVA reports initialization success in this case as well; do not
|
||||
// make the UI retry an operation that cannot safely be repeated.
|
||||
if errors.Is(err, system.ErrTaskRuntimeReload) {
|
||||
slog.ErrorContext(c.Request.Context(), "数据库初始化完成,但定时任务恢复失败", "mod", "timedTask", "error", err)
|
||||
Write(c, CodeSuccess, gin.H{}, "自动创建数据库成功")
|
||||
return
|
||||
}
|
||||
Fail(c, "自动创建数据库失败,请查看后台日志,检查后在进行初始化")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user