修改成递归通过

This commit is contained in:
huangsimin 2020-04-20 10:43:04 +08:00
parent d7bf902bc8
commit 3263a297fe
2 changed files with 5 additions and 5 deletions

1
go.sum
View File

@ -4,6 +4,7 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR
cloud.google.com/go v0.41.0/go.mod h1:OauMR7DV8fzvZIl2qg6rkaIhD/vmgk4iwEw/h6ercmg=
github.com/474420502/focus v0.8.1 h1:PZwCgzcnxwx7ZZCWc/XKLVaZPH9e4YX9cP4ckyT2HDA=
github.com/474420502/focus v0.8.1/go.mod h1:jrDXvK1CnUJ3PCR3ZJVYinbS2Yz5kM8OoAbCLe6AF7Y=
github.com/474420502/focus v0.9.0 h1:Y/TjSdSdIgegO78OJixphiPl1wVqhK9AbcXjiDDugo4=
github.com/474420502/focus v0.9.0/go.mod h1:jrDXvK1CnUJ3PCR3ZJVYinbS2Yz5kM8OoAbCLe6AF7Y=
github.com/474420502/gcurl v0.0.3 h1:gbvJ9JiiiaCkLispDZ9tlJPFo8K4e7t4JTFze3UlHHc=
github.com/474420502/gcurl v0.0.3/go.mod h1:qtCzAZZbVRIsBt0lNUh2I0qDniU9T3E21aSsVUYo7Hc=

View File

@ -121,13 +121,11 @@ func (hunter *Hunter) execute(task ITask) {
}
func (hunter *Hunter) recursionTasks() {
// 这层再加一个 Children 提取
for icxt, ok := hunter.executes.Pop(); ok; icxt, ok = hunter.executes.Pop() {
for icxt, ok := hunter.executes.Peek(); ok; icxt, ok = hunter.executes.Peek() {
cxt := icxt.(*TaskContext)
for children := cxt.parent.Children(); children != nil && children.Size() > 0; {
if children := cxt.parent.Children(); children != nil && children.Size() > 0 {
if itask, ok := children.Pop(); ok {
sautoid := strconv.Itoa(cxt.autoid)
@ -159,8 +157,9 @@ func (hunter *Hunter) recursionTasks() {
// hunter.recursionTasks(ncxt)
hunter.executes.Push(ncxt)
}
} else {
hunter.executes.Pop()
}
}