このコミットが含まれているのは:
守矢諏訪子 2024-01-19 14:06:44 +09:00
コミット d4b3cde77a
4個のファイルの変更17行の追加11行の削除

ファイルの表示

@ -16,7 +16,7 @@ jobs:
days-before-stale: 365
days-before-pr-stale: 90
days-before-close: 30
exempt-pr-labels: blocked
exempt-pr-labels: blocked,exempt-stale
stale-issue-message: 'This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.'
stale-pr-message: 'This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.'
stale-issue-label: "stale"

ファイルの表示

@ -37,7 +37,8 @@ services:
timeout: 5s
retries: 2
depends_on:
- invidious-db
invidious-db:
condition: service_healthy
invidious-db:
image: docker.io/library/postgres:14

ファイルの表示

@ -42,7 +42,7 @@ module Invidious::Routes::VideoPlayback
headers["Range"] = "bytes=#{range_for_head}"
end
client = make_client(URI.parse(host), region)
client = make_client(URI.parse(host), region, force_resolve = true)
response = HTTP::Client::Response.new(500)
error = ""
5.times do
@ -57,7 +57,7 @@ module Invidious::Routes::VideoPlayback
if new_host != host
host = new_host
client.close
client = make_client(URI.parse(new_host), region)
client = make_client(URI.parse(new_host), region, force_resolve = true)
end
url = "#{location.request_target}&host=#{location.host}#{region ? "&region=#{region}" : ""}"
@ -71,7 +71,7 @@ module Invidious::Routes::VideoPlayback
fvip = "3"
host = "https://r#{fvip}---#{mn}.googlevideo.com"
client = make_client(URI.parse(host), region)
client = make_client(URI.parse(host), region, force_resolve = true)
rescue ex
error = ex.message
end
@ -196,7 +196,7 @@ module Invidious::Routes::VideoPlayback
break
else
client.close
client = make_client(URI.parse(host), region)
client = make_client(URI.parse(host), region, force_resolve = true)
end
end

ファイルの表示

@ -26,7 +26,7 @@ struct YoutubeConnectionPool
def client(region = nil, &block)
if region
conn = make_client(url, region)
conn = make_client(url, region, force_resolve = true)
response = yield conn
else
conn = pool.checkout
@ -59,9 +59,14 @@ struct YoutubeConnectionPool
end
end
def make_client(url : URI, region = nil)
def make_client(url : URI, region = nil, force_resolve : Bool = false)
client = HTTPClient.new(url, OpenSSL::SSL::Context::Client.insecure)
client.family = CONFIG.force_resolve
# Some services do not support IPv6.
if force_resolve
client.family = CONFIG.force_resolve
end
client.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com"
client.read_timeout = 10.seconds
client.connect_timeout = 10.seconds
@ -80,8 +85,8 @@ def make_client(url : URI, region = nil)
return client
end
def make_client(url : URI, region = nil, &block)
client = make_client(url, region)
def make_client(url : URI, region = nil, force_resolve : Bool = false, &block)
client = make_client(url, region, force_resolve)
begin
yield client
ensure