mirror of https://github.com/shunfei/cronsun
parent
b2f14689de
commit
fb788a4f74
31
node/node.go
31
node/node.go
|
@ -304,23 +304,32 @@ func (n *Node) addGroup(g *cronsun.Group) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) delGroup(id string) {
|
func (n *Node) delGroup(id string) {
|
||||||
delete(n.groups, id)
|
// delete job first
|
||||||
n.link.delGroup(id)
|
defer n.link.delGroup(id)
|
||||||
|
defer delete(n.groups, id)
|
||||||
|
|
||||||
job, ok := n.jobs[id]
|
jobLinks := n.link[id]
|
||||||
// 之前此任务没有在当前结点执行
|
if len(jobLinks) == 0 {
|
||||||
if !ok {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cmds := job.Cmds(n.ID, n.groups)
|
for jID := range jobLinks {
|
||||||
if len(cmds) == 0 {
|
job, ok := n.jobs[jID]
|
||||||
return
|
// 之前此任务没有在当前结点执行
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
cmds := job.Cmds(n.ID, n.groups)
|
||||||
|
if len(cmds) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, cmd := range cmds {
|
||||||
|
n.delCmd(cmd)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cmd := range cmds {
|
|
||||||
n.delCmd(cmd)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue