From 3263a297feed16965a0fb4bf4429e4e2e1b22e64 Mon Sep 17 00:00:00 2001 From: huangsimin Date: Mon, 20 Apr 2020 10:43:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E9=80=92=E5=BD=92?= =?UTF-8?q?=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.sum | 1 + hunter.go | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.sum b/go.sum index 69f51b4..f44927d 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/hunter.go b/hunter.go index 78a1da1..7d7bd0e 100644 --- a/hunter.go +++ b/hunter.go @@ -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() } }