mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add conflict resolution for channel updates
This commit is contained in:
parent
239a6c892c
commit
10f2048d95
1 changed files with 3 additions and 2 deletions
|
@ -502,10 +502,11 @@ def get_channel(id, client, db)
|
|||
|
||||
if Time.now - channel.updated > 1.minutes
|
||||
channel = fetch_channel(id, client, db)
|
||||
channel_array = channel.to_a[1..-1]
|
||||
channel_array = channel.to_a
|
||||
args = arg_array(channel_array)
|
||||
|
||||
db.exec("UPDATE channels SET (author,updated) = (#{args}) WHERE id = '#{channel.id}'", channel_array)
|
||||
db.exec("INSERT INTO channels VALUES (#{args}) \
|
||||
ON CONFLICT (id) DO UPDATE SET author = $2, updated = $3", channel_array)
|
||||
end
|
||||
else
|
||||
channel = fetch_channel(id, client, db)
|
||||
|
|
Loading…
Reference in a new issue