Closed sstehniy closed 9 months ago
I understand that maybe i am doing it wrong, but right now no other method comes to my mind that would not involve heavily refactoring and extending my crawler logic, so i would like to know what is wrong here before i start rewriting everything... Thx
I'm working on a web crawler using the Colly library in Go, and I've encountered an issue with setting up a proxy function dynamically when the collector receives a "429 Too Many Requests" response. The goal is to enable a proxy to bypass the rate limit and then disable it after 30 seconds. However, when I try to set up the proxy switcher in response to a 429 error, I get an error: "Failed to create proxy switcher: Too Many Requests".
Note: everything works fine when i am setting the proxy just after creating the Collector, before first
colelctor.Visit
call is being made.Collector configuration:
Here's the relevant part of my code:
And the manageProxy function:
I expected the proxy to be enabled upon receiving a 429 error and then automatically disabled after 30 seconds. However, the error "Failed to create proxy switcher: Too Many Requests" is thrown immediately when trying to create the proxy switcher, preventing the proxy from being set up.
Has anyone encountered a similar issue or can provide insight into what might be going wrong here? Any help or suggestions would be greatly appreciated.