Sample proxies to avoid overloading single proxy

このコミットが含まれているのは:
Omar Roth 2018-11-20 11:18:48 -06:00
コミット 2be43c17ab
1個のファイルの変更1行の追加1行の削除

ファイルの表示

@ -30,7 +30,7 @@ def make_client(url, proxies = {} of String => Array({ip: String, port: Int32}),
client.connect_timeout = 10.seconds
if region
proxies[region]?.try &.each do |proxy|
proxies[region]?.try &.sample(40).each do |proxy|
begin
proxy = HTTPProxy.new(proxy_host: proxy[:ip], proxy_port: proxy[:port])
client.set_proxy(proxy)