@@ -114,8 +114,9 @@ class ChannelRedirect < Exception
114114 end
115115end
116116
117- def get_batch_channels (channels, refresh = false , pull_all_videos = true , max_threads = 10 )
117+ def get_batch_channels (channels )
118118 finished_channel = Channel (String | Nil ).new
119+ max_threads = 10
119120
120121 spawn do
121122 active_threads = 0
@@ -130,7 +131,7 @@ def get_batch_channels(channels, refresh = false, pull_all_videos = true, max_th
130131 active_threads += 1
131132 spawn do
132133 begin
133- get_channel(ucid, refresh, pull_all_videos )
134+ get_channel(ucid)
134135 finished_channel.send(ucid)
135136 rescue ex
136137 finished_channel.send(nil )
@@ -151,23 +152,18 @@ def get_batch_channels(channels, refresh = false, pull_all_videos = true, max_th
151152 return final
152153end
153154
154- def get_channel (id, refresh = true , pull_all_videos = true )
155- if channel = Invidious ::Database ::Channels .select(id)
156- if refresh && Time .utc - channel.updated > 10 .minutes
157- channel = fetch_channel(id, pull_all_videos: pull_all_videos)
158- Invidious ::Database ::Channels .insert(channel, update_on_conflict: true )
159- end
160- else
161- channel = fetch_channel(id, pull_all_videos: pull_all_videos)
162- Invidious ::Database ::Channels .insert(channel)
163- end
155+ def get_channel (id )
156+ channel = Invidious ::Database ::Channels .select(id)
157+ return channel if channel
164158
159+ channel = fetch_channel(id, pull_all_videos: false )
160+ Invidious ::Database ::Channels .insert(channel)
165161 return channel
166162end
167163
168- def fetch_channel (ucid, pull_all_videos = true , locale = nil )
164+ def fetch_channel (ucid, pull_all_videos : Bool )
169165 LOGGER .debug(" fetch_channel: #{ ucid } " )
170- LOGGER .trace(" fetch_channel: #{ ucid } : pull_all_videos = #{ pull_all_videos } , locale = #{ locale } " )
166+ LOGGER .trace(" fetch_channel: #{ ucid } : pull_all_videos = #{ pull_all_videos } " )
171167
172168 LOGGER .trace(" fetch_channel: #{ ucid } : Downloading RSS feed" )
173169 rss = YT_POOL .client & .get(" /feeds/videos.xml?channel_id=#{ ucid } " ).body
0 commit comments