Skip to content

Commit 6ff616d

Browse files
committed
Ensure http-proxy is not used for companion
1 parent bd2f00f commit 6ff616d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/invidious.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ end
112112

113113
COMPANION_POOL = Invidious::ConnectionPool::Pool.new(
114114
max_capacity: CONFIG.pool_size,
115+
reinitialize_proxy: false
115116
) do
116117
companion = CONFIG.invidious_companion.sample
117118
next make_client(companion.private_url, use_http_proxy: false)

src/invidious/connection/pool.cr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Invidious::ConnectionPool
88
*,
99
max_capacity : Int32 = 5,
1010
timeout : Float64 = 5.0,
11+
@reinitialize_proxy : Bool = true, # Whether or not http-proxy should be reinitialized on checkout
1112
&client_factory : -> HTTP::Client
1213
)
1314
pool_options = DB::Pool::Options.new(
@@ -57,7 +58,7 @@ module Invidious::ConnectionPool
5758
# This new TCP IO will be a direct connection to the server and will not go
5859
# through the proxy. As such we'll need to reinitialize the proxy connection
5960

60-
http_client.proxy = make_configured_http_proxy_client() if CONFIG.http_proxy
61+
http_client.proxy = make_configured_http_proxy_client() if @reinitialize_proxy && CONFIG.http_proxy
6162

6263
response = yield http_client
6364
rescue ex : DB::PoolTimeout

0 commit comments

Comments
 (0)