2020-10-06 10:11:18 +05:30
|
|
|
class Invidious::Jobs::PullPopularVideosJob < Invidious::Jobs::BaseJob
|
|
|
|
POPULAR_VIDEOS = Atomic.new([] of ChannelVideo)
|
|
|
|
private getter db : DB::Database
|
|
|
|
|
|
|
|
def initialize(@db)
|
|
|
|
end
|
|
|
|
|
|
|
|
def begin
|
|
|
|
loop do
|
2021-12-02 23:46:41 +05:30
|
|
|
videos = Invidious::Database::ChannelVideos.select_popular_videos
|
2021-09-27 03:34:33 +05:30
|
|
|
.sort_by!(&.published)
|
2021-09-25 08:20:56 +05:30
|
|
|
.reverse!
|
2020-10-06 10:11:18 +05:30
|
|
|
|
|
|
|
POPULAR_VIDEOS.set(videos)
|
|
|
|
|
|
|
|
sleep 1.minute
|
|
|
|
Fiber.yield
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|