summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-03-16 23:57:31 -0500
committerOmar Roth <omarroth@hotmail.com>2018-03-16 23:57:31 -0500
commit39df8ab200afe9556ad01a1553607a04f1ff9f38 (patch)
treefcdce13dc7cf4f37ebef0c2281320223c32df5b6
parent2be57276a27308e9e0619729905273eb285770b7 (diff)
downloadinvidious-39df8ab200afe9556ad01a1553607a04f1ff9f38.tar.gz
invidious-39df8ab200afe9556ad01a1553607a04f1ff9f38.tar.bz2
invidious-39df8ab200afe9556ad01a1553607a04f1ff9f38.zip
Add rescue for video ranking
-rw-r--r--src/helpers.cr2
-rw-r--r--src/invidious.cr6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/helpers.cr b/src/helpers.cr
index 6a707734..2f8b90b9 100644
--- a/src/helpers.cr
+++ b/src/helpers.cr
@@ -234,7 +234,7 @@ end
def rank_videos(db, n, pool, filter)
top = [] of {Float64, String}
- db.query("SELECT id, wilson_score, published FROM videos WHERE views > 5000 ORDER BY published DESC LIMIT 10000") do |rs|
+ db.query("SELECT id, wilson_score, published FROM videos WHERE views > 5000 ORDER BY published DESC LIMIT 1000") do |rs|
rs.each do
id = rs.read(String)
wilson_score = rs.read(Float64)
diff --git a/src/invidious.cr b/src/invidious.cr
index 41544f9e..d8a07421 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -147,7 +147,11 @@ spawn do
top.each do |id|
client = get_client(youtube_pool)
- videos << get_video(id, client, PG_DB)
+ begin
+ videos << get_video(id, client, PG_DB)
+ rescue ex
+ STDOUT << Time.now << " : " << ex.message << "\n"
+ end
youtube_pool << client
end