Limit number of retries to avoid infinite loop#9
Conversation
|
@ameboide What is the use case exactly? Exit from the script if the remote host or internet connection is down for a couple of minutes? @JotaSe GitHub has recently added that reaction emojis, which are actually quite nice and indicate interest in a more accessible way than the flood of "+1" comments. |
|
@pirj The use case is that the script should exit from the loop if the page is actually down or for some other reason is consistently responding with an error code. It doesn't make sense to keep switching proxies if the problem is in the other end. In my case, I had a sidekiq server that periodically executed a script that made a request to a certain page, and one day that page went down for maintenance and responded with a 403 (it's still down as of this moment). That meant the request remained in an endless loop, the script wouldn't finish, the sidekiq worker wouldn't be released, and all the available workers would be forever taken by different instances of the script, meaning it couldn't take other enqueued jobs and effectively breaking the application. |
When a page is down, it stays in an infinite loop. Added a limit to break out of it (the full circuit by default).