This commit is contained in:
2026-09-11 20:02:07 +08:00
parent ba58f9e534
commit 9e59cc4462
6 changed files with 8 additions and 30 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ import (
)
// init 数据库配置的环境变量覆盖(同一份 config.yml 线上线下通用,不用改文件切环境):
// Docker 部署由 docker-compose 注入 DB_HOST/DB_NAME 指向容器网络内的 postgres
// Docker 部署由 docker-compose 注入 DB_HOST/DB_PASS 指向容器网络内的 postgres
// 本地开发不注入,走 config.yml 默认值(127.0.0.1/animal_spot)。
// Set 是纯内存覆盖(不落盘),且必须发生在任何 g.DB() 调用(含 dao 包 init 建表)之前——
// common 包先于依赖它的 dao 包初始化,天然满足时序。
+5
View File
@@ -148,6 +148,11 @@ func (r *subprocessRunner) Start(ctx context.Context, job *TrainingJob) (int, er
}
return 0, gerror.Wrap(err, "启动训练进程失败")
}
// 子进程 Start 时已 dup 该 fd,父进程立即释放——exec.Cmd.Wait 只关内部创建的
// pipe、不关外部设置的 *os.File,不关则每次训练任务泄漏一个常开句柄
if out != nil {
_ = out.Close()
}
r.mu.Lock()
if r.cmds == nil {
r.cmds = map[int64]*exec.Cmd{}