Ensure http-proxy is not used for companion

This commit is contained in:
syeopite 2025-04-10 01:05:15 -07:00
parent edf41badc8
commit ccbbc45361
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
2 changed files with 3 additions and 1 deletions

View File

@ -112,6 +112,7 @@ end
COMPANION_POOL = Invidious::ConnectionPool::Pool.new(
max_capacity: CONFIG.pool_size,
reinitialize_proxy: false
) do
companion = CONFIG.invidious_companion.sample
next make_client(companion.private_url, use_http_proxy: false)

View File

@ -8,6 +8,7 @@ module Invidious::ConnectionPool
*,
max_capacity : Int32 = 5,
timeout : Float64 = 5.0,
@reinitialize_proxy : Bool = true, # Whether or not http-proxy should be reinitialized on checkout
&client_factory : -> HTTP::Client
)
pool_options = DB::Pool::Options.new(
@ -57,7 +58,7 @@ module Invidious::ConnectionPool
# This new TCP IO will be a direct connection to the server and will not go
# through the proxy. As such we'll need to reinitialize the proxy connection
http_client.proxy = make_configured_http_proxy_client() if CONFIG.http_proxy
http_client.proxy = make_configured_http_proxy_client() if @reinitialize_proxy && CONFIG.http_proxy
response = yield http_client
rescue ex : DB::PoolTimeout