mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-29 17:26:12 -05:00
Add logger to method calls
This commit is contained in:
parent
75d8c4f5c0
commit
4b60f7ddff
@ -108,17 +108,17 @@ LOCALES = {
|
|||||||
|
|
||||||
crawl_threads.times do
|
crawl_threads.times do
|
||||||
spawn do
|
spawn do
|
||||||
crawl_videos(PG_DB)
|
crawl_videos(PG_DB, logger)
|
||||||
end
|
end
|
||||||
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|
|
video_threads.times do |i|
|
||||||
spawn do
|
spawn do
|
||||||
refresh_videos(PG_DB)
|
refresh_videos(PG_DB, logger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
def crawl_videos(db)
|
def crawl_videos(db, logger)
|
||||||
ids = Deque(String).new
|
ids = Deque(String).new
|
||||||
random = Random.new
|
random = Random.new
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def crawl_videos(db)
|
|||||||
end
|
end
|
||||||
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
|
max_channel = Channel(Int32).new
|
||||||
|
|
||||||
spawn do
|
spawn do
|
||||||
@ -86,7 +86,7 @@ def refresh_channels(db, max_threads = 1, full_refresh = false)
|
|||||||
max_channel.send(max_threads)
|
max_channel.send(max_threads)
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_videos(db)
|
def refresh_videos(db, logger)
|
||||||
loop do
|
loop do
|
||||||
db.query("SELECT id FROM videos ORDER BY updated") do |rs|
|
db.query("SELECT id FROM videos ORDER BY updated") do |rs|
|
||||||
rs.each do
|
rs.each do
|
||||||
@ -104,7 +104,7 @@ def refresh_videos(db)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_feeds(db, max_threads = 1)
|
def refresh_feeds(db, logger, max_threads = 1)
|
||||||
max_channel = Channel(Int32).new
|
max_channel = Channel(Int32).new
|
||||||
|
|
||||||
spawn do
|
spawn do
|
||||||
|
Loading…
Reference in New Issue
Block a user