update patch about using redis video cache

This commit is contained in:
Emilien Devos
2024-08-14 19:27:45 +02:00
parent 3935de5627
commit 2f30d79bd8
+19 -17
View File
@@ -1,4 +1,4 @@
From 545d6f2c8bc66d783d5ad3c70ea39b340ba6adcd Mon Sep 17 00:00:00 2001
From 7c4c24f829b4eeb8ca035b4a9d77eef53ca8aefa Mon Sep 17 00:00:00 2001
From: Emilien Devos <contact@emiliendevos.be>
Date: Sat, 10 Jun 2023 22:21:38 +0200
Subject: [PATCH 1/1] use redis for video cache
@@ -7,13 +7,13 @@ Subject: [PATCH 1/1] use redis for video cache
shard.lock | 8 ++++++++
shard.yml | 2 ++
src/invidious.cr | 8 +++++++-
src/invidious/config.cr | 2 ++
src/invidious/config.cr | 3 +++
src/invidious/database/videos.cr | 16 +++++++++++++---
src/invidious/videos.cr | 2 +-
6 files changed, 33 insertions(+), 5 deletions(-)
6 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/shard.lock b/shard.lock
index efb60a59..1bb39934 100644
index 397bd8bc..8c599d1b 100644
--- a/shard.lock
+++ b/shard.lock
@@ -32,6 +32,10 @@ shards:
@@ -39,7 +39,7 @@ index efb60a59..1bb39934 100644
git: https://github.com/icy-arctic-fox/spectator.git
version: 0.10.4
diff --git a/shard.yml b/shard.yml
index be06a7df..eb59ec32 100644
index 367f7c73..c46e1c42 100644
--- a/shard.yml
+++ b/shard.yml
@@ -28,6 +28,8 @@ dependencies:
@@ -52,7 +52,7 @@ index be06a7df..eb59ec32 100644
development_dependencies:
spectator:
diff --git a/src/invidious.cr b/src/invidious.cr
index 011c427f..ec8b3520 100644
index 3804197e..e2d40597 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -31,6 +31,7 @@ require "xml"
@@ -78,18 +78,19 @@ index 011c427f..ec8b3520 100644
PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com")
REDDIT_URL = URI.parse("https://www.reddit.com")
diff --git a/src/invidious/config.cr b/src/invidious/config.cr
index 87ba324e..6cdb374f 100644
index c4ddcdb3..5b6c576c 100644
--- a/src/invidious/config.cr
+++ b/src/invidious/config.cr
@@ -72,6 +72,8 @@ class Config
# Database configuration using 12-Factor "Database URL" syntax
@[YAML::Field(converter: Preferences::URIConverter)]
property database_url : URI = URI.parse("")
@@ -77,6 +77,9 @@ class Config
# Used for crawling channels: threads should check all videos uploaded by a channel
property full_refresh : Bool = false
+ property redis_url : String?
+ property redis_socket : String?
# Use polling to keep decryption function up to date
property decrypt_polling : Bool = false
# Used for crawling channels: threads should check all videos uploaded by a channel
+
# Jobs config structure. See jobs.cr and jobs/base_job.cr
property jobs = Invidious::Jobs::JobsConfig.new
diff --git a/src/invidious/database/videos.cr b/src/invidious/database/videos.cr
index 695f5b33..776ef5b1 100644
--- a/src/invidious/database/videos.cr
@@ -131,10 +132,10 @@ index 695f5b33..776ef5b1 100644
end
end
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index f38b33e5..2a22a862 100644
index 6d0cf9ba..dde35291 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -355,7 +355,7 @@ def get_video(id, refresh = true, region = nil, force_refresh = false)
@@ -400,7 +400,7 @@ def get_video(id, refresh = true, region = nil, force_refresh = false)
video.schema_version != Video::SCHEMA_VERSION # cache control
begin
video = fetch_video(id, region)
@@ -144,4 +145,5 @@ index f38b33e5..2a22a862 100644
Invidious::Database::Videos.delete(id)
raise ex
--
2.41.0
2.46.0