|
|
@ -489,11 +489,12 @@ def get_channel(id, client, db)
|
|
|
|
if db.query_one?("SELECT EXISTS (SELECT true FROM channels WHERE id = $1)", id, as: Bool)
|
|
|
|
if db.query_one?("SELECT EXISTS (SELECT true FROM channels WHERE id = $1)", id, as: Bool)
|
|
|
|
channel = db.query_one("SELECT * FROM channels WHERE id = $1", id, as: InvidiousChannel)
|
|
|
|
channel = db.query_one("SELECT * FROM channels WHERE id = $1", id, as: InvidiousChannel)
|
|
|
|
|
|
|
|
|
|
|
|
if Time.now - channel.updated > 1.hours
|
|
|
|
if Time.now - channel.updated > 1.minutes
|
|
|
|
db.exec("DELETE FROM channels * WHERE id = $1", id)
|
|
|
|
|
|
|
|
channel = fetch_channel(id, client)
|
|
|
|
channel = fetch_channel(id, client)
|
|
|
|
args = arg_array(channel.to_a)
|
|
|
|
channel_array = channel.to_a[1..-1]
|
|
|
|
db.exec("INSERT INTO channels VALUES (#{args})", channel.to_a)
|
|
|
|
args = arg_array(channel_array)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.exec("UPDATE channels SET (rss,updated,author) = (#{args}) WHERE id = '#{channel.id}'", channel_array)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
channel = fetch_channel(id, client)
|
|
|
|
channel = fetch_channel(id, client)
|
|
|
|