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

Update Spider.java #1052

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Update Spider.java #1052

wants to merge 1 commit into from

Conversation

GG22G2
Copy link

@GG22G2 GG22G2 commented Jan 6, 2022

根据响应状态码判断是否走重试机制

根据响应状态码判断是否走重试机制
@@ -438,7 +438,7 @@ private void processRequest(Request request) {
}else {
page = downloader.download(request, this);
}
if (page.isDownloadSuccess()){
if (page.isDownloadSuccess()&&site.getAcceptStatCode().contains(page.getStatusCode())){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

我感觉都可以

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

我只是把onDownloadSuccess中的判断提前到processRequest中了。如果修改isDownloadSuccess,就不能借助Site.acceptStatCode了,或者要改动的会更多一点。

Copy link
Collaborator

@sutra sutra Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面调用的 onDownloadSucess 里其实有 if (site.getAcceptStatCode().contains(page.getStatusCode())){ 感觉这整个逻辑有点乱。可以帮忙再多考虑一些。

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

Successfully merging this pull request may close these issues.

2 participants