mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Speed up importing watch history
This commit is contained in:
parent
6ae5d489ec
commit
c5d2a57206
1 changed files with 5 additions and 8 deletions
|
@ -1228,17 +1228,14 @@ post "/data_control" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
body["watch_history"]?.try &.as_a.each do |id|
|
if body["watch_history"]?
|
||||||
id = id.as_s
|
watched = user.watched + body["watch_history"].as_a.map { |a| a.as_s }
|
||||||
|
watched.uniq!
|
||||||
if !user.watched.includes? id
|
PG_DB.exec("UPDATE users SET watched = $1 WHERE email = $2", watched, user.email)
|
||||||
PG_DB.exec("UPDATE users SET watched = array_append(watched,$1) WHERE email = $2", id, user.email)
|
|
||||||
user.watched << id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if body["preferences"]?
|
if body["preferences"]?
|
||||||
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", body["preferences"].to_json, user.email)
|
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", body["preferences"].to_json, user.email)
|
||||||
end
|
end
|
||||||
when "import_youtube"
|
when "import_youtube"
|
||||||
subscriptions = XML.parse(body)
|
subscriptions = XML.parse(body)
|
||||||
|
|
Loading…
Reference in a new issue