From 245122104a31608360f1749119716e6b8fc2a6b0 Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 28 Sep 2021 17:21:26 -0700 Subject: [PATCH] Respect use_quic param and fix typos --- src/invidious/routes/login.cr | 2 +- src/invidious/yt_backend/connection_pool.cr | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index 2d303713..562d88e5 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -55,7 +55,7 @@ module Invidious::Routes::Login begin client = nil # Declare variable {% 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 %} client = HTTP::Client.new(LOGIN_URL) {% end %} diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr index 4bf200cc..fe7a572d 100644 --- a/src/invidious/yt_backend/connection_pool.cr +++ b/src/invidious/yt_backend/connection_pool.cr @@ -3,9 +3,9 @@ require "lsquic" {% unless flag?(:disable_quic) %} require "lsquic" - alias ConnectonClientType = QUIC::Client | HTTP::Client + alias HTTPClientType = QUIC::Client | HTTP::Client {% else %} - alias ConnectonClientType = HTTP::Client + alias HTTPClientType = HTTP::Client {% end %} def add_yt_headers(request) @@ -27,7 +27,7 @@ struct YoutubeConnectionPool property! url : URI property! capacity : Int32 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) @url = url @@ -45,7 +45,7 @@ struct YoutubeConnectionPool rescue ex conn.close {% unless flag?(:disable_quic) %} - conn = QUIC::Client.new(url) + conn = CONFIG.use_quic ? QUIC::Client.new(url) : HTTP::Client.new(url) {% else %} conn = HTTP::Client.new(url) {% end %} @@ -63,7 +63,7 @@ struct YoutubeConnectionPool end 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 {% unless flag?(:disable_quic) %} if use_quic