Add logger to method calls

This commit is contained in:
Omar Roth 2019-01-24 12:19:02 -06:00
parent 75d8c4f5c0
commit 4b60f7ddff
2 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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