Skip to content

Commit 227a361

Browse files
author
Qi Xiao
committed
Cancel timeout trigger after parser complete
1 parent 02b0373 commit 227a361

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

parser/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,14 @@ func (t *Task) Parse(site string) (err error) {
192192

193193
pageWait := make(chan struct{}, 1)
194194

195-
time.AfterFunc(t.cfg.Timeout, func() {
195+
tm := time.AfterFunc(t.cfg.Timeout, func() {
196196
logrus.WithField("site", site).Debug("timeout triggered")
197197
select {
198198
case pageWait <- struct{}{}:
199199
default:
200200
}
201201
})
202+
defer tm.Stop()
202203

203204
// page stopped loading event
204205
t.remote.CallbackEvent("Page.frameStoppedLoading", func(params godet.Params) {

0 commit comments

Comments
 (0)