Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code Review] 函数中的无效参数 #113

Open
PIGfaces opened this issue Jul 5, 2022 Discussed in #107 · 0 comments
Open

[Code Review] 函数中的无效参数 #113

PIGfaces opened this issue Jul 5, 2022 Discussed in #107 · 0 comments

Comments

@PIGfaces
Copy link
Contributor

PIGfaces commented Jul 5, 2022

Discussed in #107

Originally posted by PIGfaces June 28, 2022

crawlergo/pkg/engine/tab.go

Lines 264 to 270 in dbf7064

func RunWithTimeOut(ctx *context.Context, timeout time.Duration, tasks chromedp.Tasks) chromedp.ActionFunc {
return func(ctx context.Context) error {
timeoutContext, _ := context.WithTimeout(ctx, timeout)
//defer cancel()
return tasks.Do(timeoutContext)
}
}

函数 RunWithTimeOut 中的 ctx 参数并没使用到,可以把它去掉吗,真正用到 ctx 是上层的函数调用,上层的 context 超时时间为 TabRunTimeout 到了这一层变成了 DomContentLoadedTimeout 这是出于什么原因呀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant