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

feat: add an interval option to avoid triggering rate limit #185

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

LeslieLeung
Copy link
Contributor

在使用下载一些有很多课程的纯 Markdown 时发现在下载几十个之后会触发限流,检查源码发现如果是下载 PDF,每个页面打开后会等待一段时间,因此不太可能会触发限流,但下载 Markdown 的时候没有这个长的间隔,只有一个2秒内的随机间隔。

因此增加了一个 interval 选项,以秒为单位,在每篇文章之间间隔 interval 秒 + 2秒内的 jitter 来避免触发限流限制。默认为0秒秒,兼容以前的状态。实测 interval = 5时,下载120篇左右的文章不会触发限流。

@nicoxiang
Copy link
Owner

LGTM

@nicoxiang nicoxiang merged commit e8df39c into nicoxiang:main Apr 14, 2024
1 check passed
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