summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-02-04 19:40:06 -0600
committerOmar Roth <omarroth@hotmail.com>2018-02-04 19:40:06 -0600
commit1facca5408489f63ec0c6edf4cc1f8574c20dd98 (patch)
tree5edf8e27d6bfe7b1e30eea2947075996fbc41788
parent03aeb27b4051e22b01a0bf435bf7ff388914a2be (diff)
downloadinvidious-1facca5408489f63ec0c6edf4cc1f8574c20dd98.tar.gz
invidious-1facca5408489f63ec0c6edf4cc1f8574c20dd98.tar.bz2
invidious-1facca5408489f63ec0c6edf4cc1f8574c20dd98.zip
Replace unnecessary constant
-rw-r--r--src/invidious.cr16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 19ecd4c0..54aaa55f 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -47,7 +47,7 @@ CONTEXT.add_options(
OpenSSL::SSL::Options::NO_SSL_V2 |
OpenSSL::SSL::Options::NO_SSL_V3
)
-POOL = Deque.new(30) do
+pool = Deque.new((threads * 1.2).to_i) do
client = HTTP::Client.new(URL, CONTEXT)
client.read_timeout = 5.seconds
client.connect_timeout = 5.seconds
@@ -60,7 +60,7 @@ threads.times do
io = STDOUT
ids = Deque(String).new
random = Random.new
- client = get_client(POOL)
+ client = get_client(pool)
search(random.base64(3), client) do |id|
ids << id
@@ -77,20 +77,20 @@ threads.times do
client = HTTP::Client.new(URL, CONTEXT)
client.read_timeout = 5.seconds
client.connect_timeout = 5.seconds
- POOL << client
+ pool << client
end
time = Time.now
begin
id = ids[0]
- video = get_video(id, client, PG_DB, false)
+ video = get_video(id, client, PG_DB)
rescue ex
io << id << " : " << ex << "\n"
client = HTTP::Client.new(URL, CONTEXT)
client.read_timeout = 5.seconds
client.connect_timeout = 5.seconds
- POOL << client
+ pool << client
next
ensure
ids.delete(id)
@@ -132,7 +132,7 @@ get "/watch" do |env|
env.params.query.delete_all("listen")
- client = get_client(POOL)
+ client = get_client(pool)
begin
video = get_video(id, client, PG_DB)
rescue ex
@@ -191,7 +191,7 @@ get "/search" do |env|
query = env.params.query["q"]
page = env.params.query["page"]? && env.params.query["page"].to_i? ? env.params.query["page"].to_i : 1
- client = get_client(POOL)
+ client = get_client(pool)
html = client.get("https://www.youtube.com/results?q=#{URI.escape(query)}&page=#{page}&sp=EgIQAVAU").body
html = XML.parse_html(html)
@@ -233,7 +233,7 @@ get "/search" do |env|
end
end
- POOL << client
+ pool << client
templated "search"
end