Throttle Mechanize gem
Is there any built-in way to throttle Mechanize gem?
I'm searching something like a callback on making an HTTP request.
Later edit:开发者_StackOverflow社区 I would like to implement bandwith throttling, to avoid flooding parsed sites. EG: Only allow one request per second.
It may be that pre_connect_hooks is what you are looking for. Sadly, I am unable to find any way to add one but adding directly a lambda/Proc to the array.
They are called here and this method is called here
精彩评论