From 2be43c17aba4d1bbc2cd88f9ad5adadebe7bb309 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 20 Nov 2018 11:18:48 -0600 Subject: [PATCH] Sample proxies to avoid overloading single proxy --- src/invidious/helpers/utils.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index f1339749..496c3e0d 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -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)