mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-24 17:19:51 +05:30
Shrink size between video requests
This commit is contained in:
parent
dc6cc028c5
commit
ffab3ee79f
@ -367,8 +367,8 @@ def get_video(id, db, refresh = true)
|
|||||||
if db.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", id, as: Bool)
|
if db.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", id, as: Bool)
|
||||||
video = db.query_one("SELECT * FROM videos WHERE id = $1", id, as: Video)
|
video = db.query_one("SELECT * FROM videos WHERE id = $1", id, as: Video)
|
||||||
|
|
||||||
# If record was last updated over an hour ago, refresh (expire param in response lasts for 6 hours)
|
# If record was last updated over 10 minutes ago, refresh (expire param in response lasts for 6 hours)
|
||||||
if refresh && Time.now - video.updated > 1.hour
|
if refresh && Time.now - video.updated > 10.minutes
|
||||||
begin
|
begin
|
||||||
video = fetch_video(id)
|
video = fetch_video(id)
|
||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
|
Loading…
Reference in New Issue
Block a user