mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-11-03 22:21:55 +00:00 
			
		
		
		
	Ensure http-proxy is not used for companion
This commit is contained in:
		@@ -112,6 +112,7 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
COMPANION_POOL = Invidious::ConnectionPool::Pool.new(
 | 
					COMPANION_POOL = Invidious::ConnectionPool::Pool.new(
 | 
				
			||||||
  max_capacity: CONFIG.pool_size,
 | 
					  max_capacity: CONFIG.pool_size,
 | 
				
			||||||
 | 
					  reinitialize_proxy: false
 | 
				
			||||||
) do
 | 
					) do
 | 
				
			||||||
  companion = CONFIG.invidious_companion.sample
 | 
					  companion = CONFIG.invidious_companion.sample
 | 
				
			||||||
  next make_client(companion.private_url, use_http_proxy: false)
 | 
					  next make_client(companion.private_url, use_http_proxy: false)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ module Invidious::ConnectionPool
 | 
				
			|||||||
      *,
 | 
					      *,
 | 
				
			||||||
      max_capacity : Int32 = 5,
 | 
					      max_capacity : Int32 = 5,
 | 
				
			||||||
      timeout : Float64 = 5.0,
 | 
					      timeout : Float64 = 5.0,
 | 
				
			||||||
 | 
					      @reinitialize_proxy : Bool = true, # Whether or not http-proxy should be reinitialized on checkout
 | 
				
			||||||
      &client_factory : -> HTTP::Client
 | 
					      &client_factory : -> HTTP::Client
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
      pool_options = DB::Pool::Options.new(
 | 
					      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
 | 
					      # 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
 | 
					      # 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
 | 
					      response = yield http_client
 | 
				
			||||||
    rescue ex : DB::PoolTimeout
 | 
					    rescue ex : DB::PoolTimeout
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user