diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-11-26 20:46:08 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-11-26 20:46:08 -0600 |
| commit | dcf45d217facfd21224e4bf00a0e8a20e9f05924 (patch) | |
| tree | b6250789e415bba51e505432ee1b250c08cfac08 | |
| parent | d211d8fc05bdfa95377ec37bbde5929e57b9f507 (diff) | |
| download | invidious-dcf45d217facfd21224e4bf00a0e8a20e9f05924.tar.gz invidious-dcf45d217facfd21224e4bf00a0e8a20e9f05924.tar.bz2 invidious-dcf45d217facfd21224e4bf00a0e8a20e9f05924.zip | |
Don't cache results when using proxy
| -rw-r--r-- | src/invidious/videos.cr | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 3934a66f..ab9b49e6 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -508,7 +508,7 @@ class VideoRedirect < Exception end def get_video(id, db, proxies = {} of String => Array({ip: String, port: Int32}), refresh = true, region = nil) - 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) && !region video = db.query_one("SELECT * FROM videos WHERE id = $1", id, as: Video) # If record was last updated over 10 minutes ago, refresh (expire param in response lasts for 6 hours) @@ -534,7 +534,9 @@ def get_video(id, db, proxies = {} of String => Array({ip: String, port: Int32}) args = arg_array(video_array) - db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array) + if !region + db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array) + end end return video |
