Skip to content

Commit 04c668d

Browse files
authored
[BUG] Fix the e2e test ​​being blocked​​ by the cleanup step when the verify step takes longer than the trigger step (#133)
1 parent 4e51bfb commit 04c668d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/components/trigger/http.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewHTTPAction(intervalStr string, times int, url, method, body string, head
6262
body: body,
6363
headers: headers,
6464
executedCount: 0,
65-
stopCh: make(chan struct{}),
65+
stopCh: make(chan struct{}, 1),
6666
client: &http.Client{},
6767
}, nil
6868
}
@@ -75,6 +75,7 @@ func (h *httpAction) Do() chan error {
7575
result := make(chan error)
7676
sent := false
7777
go func() {
78+
defer t.Stop()
7879
for {
7980
select {
8081
case <-t.C:
@@ -87,12 +88,9 @@ func (h *httpAction) Do() chan error {
8788
sent = true
8889
}
8990
if h.times == h.executedCount {
90-
t.Stop()
9191
return
9292
}
9393
case <-h.stopCh:
94-
t.Stop()
95-
result <- nil
9694
return
9795
}
9896
}

0 commit comments

Comments
 (0)