mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Respect use_quic param and fix typos
This commit is contained in:
parent
b0f127d4d8
commit
245122104a
2 changed files with 6 additions and 6 deletions
|
@ -55,7 +55,7 @@ module Invidious::Routes::Login
|
||||||
begin
|
begin
|
||||||
client = nil # Declare variable
|
client = nil # Declare variable
|
||||||
{% unless flag?(:disable_quic) %}
|
{% unless flag?(:disable_quic) %}
|
||||||
client = QUIC::Client.new(LOGIN_URL)
|
client = CONFIG.use_quic ? QUIC::Client.new(LOGIN_URL) : HTTP::Client.new(LOGIN_URL)
|
||||||
{% else %}
|
{% else %}
|
||||||
client = HTTP::Client.new(LOGIN_URL)
|
client = HTTP::Client.new(LOGIN_URL)
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
|
@ -3,9 +3,9 @@ require "lsquic"
|
||||||
{% unless flag?(:disable_quic) %}
|
{% unless flag?(:disable_quic) %}
|
||||||
require "lsquic"
|
require "lsquic"
|
||||||
|
|
||||||
alias ConnectonClientType = QUIC::Client | HTTP::Client
|
alias HTTPClientType = QUIC::Client | HTTP::Client
|
||||||
{% else %}
|
{% else %}
|
||||||
alias ConnectonClientType = HTTP::Client
|
alias HTTPClientType = HTTP::Client
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
def add_yt_headers(request)
|
def add_yt_headers(request)
|
||||||
|
@ -27,7 +27,7 @@ struct YoutubeConnectionPool
|
||||||
property! url : URI
|
property! url : URI
|
||||||
property! capacity : Int32
|
property! capacity : Int32
|
||||||
property! timeout : Float64
|
property! timeout : Float64
|
||||||
property pool : DB::Pool(ConnectonClientType)
|
property pool : DB::Pool(HTTPClientType)
|
||||||
|
|
||||||
def initialize(url : URI, @capacity = 5, @timeout = 5.0, use_quic = true)
|
def initialize(url : URI, @capacity = 5, @timeout = 5.0, use_quic = true)
|
||||||
@url = url
|
@url = url
|
||||||
|
@ -45,7 +45,7 @@ struct YoutubeConnectionPool
|
||||||
rescue ex
|
rescue ex
|
||||||
conn.close
|
conn.close
|
||||||
{% unless flag?(:disable_quic) %}
|
{% unless flag?(:disable_quic) %}
|
||||||
conn = QUIC::Client.new(url)
|
conn = CONFIG.use_quic ? QUIC::Client.new(url) : HTTP::Client.new(url)
|
||||||
{% else %}
|
{% else %}
|
||||||
conn = HTTP::Client.new(url)
|
conn = HTTP::Client.new(url)
|
||||||
{% end %}
|
{% end %}
|
||||||
|
@ -63,7 +63,7 @@ struct YoutubeConnectionPool
|
||||||
end
|
end
|
||||||
|
|
||||||
private def build_pool(use_quic)
|
private def build_pool(use_quic)
|
||||||
DB::Pool(ConnectonClientType).new(initial_pool_size: 0, max_pool_size: capacity, max_idle_pool_size: capacity, checkout_timeout: timeout) do
|
DB::Pool(HTTPClientType).new(initial_pool_size: 0, max_pool_size: capacity, max_idle_pool_size: capacity, checkout_timeout: timeout) do
|
||||||
conn = nil # Declare
|
conn = nil # Declare
|
||||||
{% unless flag?(:disable_quic) %}
|
{% unless flag?(:disable_quic) %}
|
||||||
if use_quic
|
if use_quic
|
||||||
|
|
Loading…
Reference in a new issue