Skip to content

Commit b0efa97

Browse files
zhengboahzhengb-gc
andauthored
Fix dialtesting multi task (#173)
* fix(dialtesting): fix multi task retry * save --------- Co-authored-by: zhengb <zhengb@guance.com>
1 parent 2063bc8 commit b0efa97

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

dialtesting/multi.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,13 @@ func (t *MultiTask) runHTTPStep(step *MultiStep) (map[string]interface{}, error)
164164
for runCount < maxCount {
165165
httpTask := &HTTPTask{}
166166
task, err = NewTask(step.TaskString, httpTask)
167-
if t.beforeRun != nil {
168-
task.SetBeforeRun(t.beforeRun)
169-
}
170167
if err != nil {
171168
return nil, fmt.Errorf("new task failed: %w", err)
172169
}
170+
171+
if t.beforeRun != nil {
172+
task.SetBeforeRun(t.beforeRun)
173+
}
173174
task.SetOption(t.GetOption())
174175
for _, v := range t.extractedVars {
175176
task.AddExtractedVar(&ConfigVar{
@@ -221,6 +222,10 @@ func (t *MultiTask) runHTTPStep(step *MultiStep) (map[string]interface{}, error)
221222
}
222223
task.Stop()
223224

225+
if err == nil && result["status"] == "OK" {
226+
break
227+
}
228+
224229
runCount++
225230
if runCount < maxCount {
226231
time.Sleep(interval)

0 commit comments

Comments
 (0)