From 4c1db6e03e6ad6a64ca94525c4a5a68d8efe876b Mon Sep 17 00:00:00 2001 From: syeopite Date: Thu, 14 Nov 2024 19:52:48 -0800 Subject: [PATCH] Simplify namespace calls to ConnectionPool --- src/invidious/connection/pool.cr | 4 ++-- src/invidious/routes/images.cr | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/invidious/connection/pool.cr b/src/invidious/connection/pool.cr index c10ea7b0..66c4eaf4 100644 --- a/src/invidious/connection/pool.cr +++ b/src/invidious/connection/pool.cr @@ -87,7 +87,7 @@ module Invidious::ConnectionPool # Mapping of subdomain => Invidious::ConnectionPool::Pool # This is needed as we may need to access arbitrary subdomains of ytimg - private YTIMG_POOLS = {} of String => Invidious::ConnectionPool::Pool + private YTIMG_POOLS = {} of String => ConnectionPool::Pool # Fetches a HTTP pool for the specified subdomain of ytimg.com # @@ -97,7 +97,7 @@ module Invidious::ConnectionPool return pool else LOGGER.info("ytimg_pool: Creating a new HTTP pool for \"https://#{subdomain}.ytimg.com\"") - pool = Invidious::ConnectionPool::Pool.new( + pool = ConnectionPool::Pool.new( URI.parse("https://#{subdomain}.ytimg.com"), max_capacity: CONFIG.pool_size, idle_capacity: CONFIG.idle_pool_size, diff --git a/src/invidious/routes/images.cr b/src/invidious/routes/images.cr index 1deec90a..0670760c 100644 --- a/src/invidious/routes/images.cr +++ b/src/invidious/routes/images.cr @@ -42,7 +42,7 @@ module Invidious::Routes::Images end begin - Invidious::ConnectionPool.get_ytimg_pool(authority).get(url, headers) do |resp| + ConnectionPool.get_ytimg_pool(authority).get(url, headers) do |resp| env.response.headers["Connection"] = "close" return self.proxy_image(env, resp) end @@ -65,7 +65,7 @@ module Invidious::Routes::Images end begin - Invidious::ConnectionPool.get_ytimg_pool("i9").get(url, headers) do |resp| + ConnectionPool.get_ytimg_pool("i9").get(url, headers) do |resp| return self.proxy_image(env, resp) end rescue ex @@ -111,7 +111,7 @@ module Invidious::Routes::Images if name == "maxres.jpg" build_thumbnails(id).each do |thumb| thumbnail_resource_path = "/vi/#{id}/#{thumb[:url]}.jpg" - if Invidious::ConnectionPool.get_ytimg_pool("i9").head(thumbnail_resource_path, headers).status_code == 200 + if ConnectionPool.get_ytimg_pool("i9").head(thumbnail_resource_path, headers).status_code == 200 name = thumb[:url] + ".jpg" break end @@ -127,7 +127,7 @@ module Invidious::Routes::Images end begin - Invidious::ConnectionPool.get_ytimg_pool("i").get(url, headers) do |resp| + ConnectionPool.get_ytimg_pool("i").get(url, headers) do |resp| return self.proxy_image(env, resp) end rescue ex