-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Randomized Delay #54
Comments
@jodizzle this would be a handy addition. Do you want to work on it? As a workaround you can add an OnRequest callback with random sleeps: c.OnRequest(func(_ *colly.Request) {
time.Sleep(time.Duration(rand.Randint(5)+1) * time.Second)
}) |
@asciimoo Ah, I hadn't thought of the And sure, I can try working on it. Do you have any thoughts about what the best implementation would be? |
I like the idea of extending |
That sounds pretty reasonable. I'll take a look. |
@jlr52 Fine by me -- I was being slow. Your approach seems similar to what I was thinking anyway. I'll take a closer look. |
Is it possible to create randomized delays, i.e., per-request delays selected from some range or based on some random factor? I couldn't think of a good way to do this, other than maybe cycling through several
Collector
s with different limit sets, which seems sub-optimal.It seems like having
LimitRule.DelayRange
orLimitRule.RandomFactor
options would be quite helpful.The text was updated successfully, but these errors were encountered: