Add back in refreshing of channels every 2 days

This commit is contained in:
matthewmcgarvey
2022-01-24 23:14:13 -06:00
parent a82d21ff78
commit e92b3779ad
2 changed files with 14 additions and 5 deletions

View File

@@ -152,12 +152,14 @@ def get_batch_channels(channels)
return final
end
def get_channel(id)
def get_channel(id) : InvidiousChannel
channel = Invidious::Database::Channels.select(id)
return channel if channel
channel = fetch_channel(id, pull_all_videos: false)
Invidious::Database::Channels.insert(channel)
if channel.nil? || (Time.utc - channel.updated) > 2.days
channel = fetch_channel(id, pull_all_videos: false)
Invidious::Database::Channels.insert(channel, update_on_conflict: true)
end
return channel
end