From 4b60f7ddff900d60a86410d40bdd55f9883b87da Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 24 Jan 2019 12:19:02 -0600 Subject: [PATCH] Add logger to method calls --- src/invidious.cr | 8 ++++---- src/invidious/jobs.cr | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 7f77e317..1a96b50a 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -108,17 +108,17 @@ LOCALES = { crawl_threads.times do spawn do - crawl_videos(PG_DB) + crawl_videos(PG_DB, logger) end end -refresh_channels(PG_DB, channel_threads, CONFIG.full_refresh) +refresh_channels(PG_DB, logger, channel_threads, CONFIG.full_refresh) -refresh_feeds(PG_DB, feed_threads) +refresh_feeds(PG_DB, logger, feed_threads) video_threads.times do |i| spawn do - refresh_videos(PG_DB) + refresh_videos(PG_DB, logger) end end diff --git a/src/invidious/jobs.cr b/src/invidious/jobs.cr index 81271cb3..f6e2d8fe 100644 --- a/src/invidious/jobs.cr +++ b/src/invidious/jobs.cr @@ -1,4 +1,4 @@ -def crawl_videos(db) +def crawl_videos(db, logger) ids = Deque(String).new random = Random.new @@ -46,7 +46,7 @@ def crawl_videos(db) end end -def refresh_channels(db, max_threads = 1, full_refresh = false) +def refresh_channels(db, logger, max_threads = 1, full_refresh = false) max_channel = Channel(Int32).new spawn do @@ -86,7 +86,7 @@ def refresh_channels(db, max_threads = 1, full_refresh = false) max_channel.send(max_threads) end -def refresh_videos(db) +def refresh_videos(db, logger) loop do db.query("SELECT id FROM videos ORDER BY updated") do |rs| rs.each do @@ -104,7 +104,7 @@ def refresh_videos(db) end end -def refresh_feeds(db, max_threads = 1) +def refresh_feeds(db, logger, max_threads = 1) max_channel = Channel(Int32).new spawn do