1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

feature(worker): use cgroup track job process, so that they can be all-killed

这个提交包含在:
bigeagle
2016-04-29 16:05:15 +08:00
父节点 41e1f263a5
当前提交 924fda6dd8
共有 11 个文件被更改,包括 250 次插入17 次删除

查看文件

@@ -152,6 +152,14 @@ func (w *Worker) initProviders() {
}
provider.AddHook(newLogLimiter(provider))
// Add Cgroup Hook
if w.cfg.Cgroup.Enable {
provider.AddHook(
newCgroupHook(provider, w.cfg.Cgroup.BasePath, w.cfg.Cgroup.Group),
)
}
w.providers[provider.Name()] = provider
}
@@ -198,13 +206,13 @@ func (w *Worker) makeHTTPServer() {
case CmdStop:
// if job is disabled, no goroutine would be there
// receiving this signal
w.schedule.Remove(job.Name())
if job.State() != stateDisabled {
w.schedule.Remove(job.Name())
job.ctrlChan <- jobStop
}
case CmdDisable:
w.schedule.Remove(job.Name())
if job.State() != stateDisabled {
w.schedule.Remove(job.Name())
job.ctrlChan <- jobDisable
<-job.disabled
}