-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
调整重试逻辑 #1170
Open
niuxiaozu
wants to merge
1
commit into
code4craft:develop
Choose a base branch
from
niuxiaozu:develop2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
调整重试逻辑 #1170
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y重试逻辑。并且加入队列前先sleep。
原本的设计是只在发生异常的时候才去 |
主要是缺少一个处理状态码错误的方式,之前我是通过继承HttpClientDownloader,在内部判定状态码不对的情况将page。downloadSuccess设置为false,但总感觉不太好,后面才选用的这种方式。如果你觉得设计不是这样的,那就算啦,不过我感觉确实得有一个处理状态码不对时的重试逻辑 |
我推荐用 |
那样得大改了,我只是借用现有的机制小做修改😅 |
如果仅仅是使用 SpiderListener 来处理 status code,是不需要修改 webmagic 代码的,直接在自己的代码里加 SpiderListener 并注册就好了。Sent from my iPhoneOn Jun 17, 2024, at 5:35 PM, Niu_XZ ***@***.***> wrote:
那样得大改了,我只是借用现有的机制小做修改😅
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
好像不行,因为onError只有在抛出异常的时候才调用,而状态码不对的时候,不抛出异常,只是打了个log
|
实现这个 |
这样是可以的,我先试试吧,感谢 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修改download成功后对状态码的处理,如果状态码不被site.acceptStatCode接收的话就算失败,进行doCycleRetry重试逻辑。并且加入队列前先sleep。