mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add multithreading to pubsub job
This commit is contained in:
parent
31312747e9
commit
305d636217
3 changed files with 43 additions and 11 deletions
|
@ -2344,7 +2344,8 @@ get "/feed/webhook/:token" do |env|
|
|||
data = "#{time}"
|
||||
end
|
||||
|
||||
# The hub will sometimes check if we're still subscribed after delivery errors
|
||||
# The hub will sometimes check if we're still subscribed after delivery errors,
|
||||
# so we reply with a 200 as long as the request hasn't expired
|
||||
if Time.now.to_unix - time.to_i > 432000
|
||||
env.response.status_code = 400
|
||||
next
|
||||
|
@ -2377,11 +2378,12 @@ post "/feed/webhook/:token" do |env|
|
|||
rss = XML.parse_html(body)
|
||||
rss.xpath_nodes("//feed/entry").each do |entry|
|
||||
id = entry.xpath_node("videoid").not_nil!.content
|
||||
author = entry.xpath_node("author/name").not_nil!.content
|
||||
published = Time.parse_rfc3339(entry.xpath_node("published").not_nil!.content)
|
||||
updated = Time.parse_rfc3339(entry.xpath_node("updated").not_nil!.content)
|
||||
|
||||
video = get_video(id, PG_DB, proxies, region: nil)
|
||||
video = ChannelVideo.new(id, video.title, published, updated, video.ucid, video.author, video.length_seconds, video.live_now, video.premiere_timestamp)
|
||||
video = ChannelVideo.new(id, video.title, published, updated, video.ucid, author, video.length_seconds, video.live_now, video.premiere_timestamp)
|
||||
|
||||
PG_DB.exec("UPDATE users SET notifications = notifications || $1 \
|
||||
WHERE updated < $2 AND $3 = ANY(subscriptions) AND $1 <> ALL(notifications)", video.id, video.published, video.ucid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue