Closed unixfox closed 2 years ago
bump
require "./base.cr"
module Invidious::Database::Videos
extend self
def insert(video : Video)
request = <<-SQL
INSERT INTO videos
VALUES ($1, $2, $3)
ON CONFLICT (id) DO NOTHING
SQL
ENV.fetch("SALUT", "")
PG_DB.exec(request, video.id + ENV.fetch("NODE_NAME", ""), video.info.to_json, video.updated)
end
def delete(id)
request = <<-SQL
DELETE FROM videos *
WHERE id = $1
SQL
PG_DB.exec(request, id + ENV.fetch("NODE_NAME", ""))
end
def update(video : Video)
request = <<-SQL
UPDATE videos
SET (id, info, updated) = ($1, $2, $3)
WHERE id = $1
SQL
PG_DB.exec(request, video.id + ENV.fetch("NODE_NAME", ""), video.info.to_json, video.updated)
end
def select(id : String) : Video?
request = <<-SQL
SELECT * FROM videos
WHERE id = $1
SQL
return PG_DB.query_one?(request, id + ENV.fetch("NODE_NAME", ""), as: Video)
end
end
Use https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/, need to upgrade to Kubernetes 1.23.
And use external domains for each proxy, this way the videoplayback URL is correctly generated.
Use kubernetes.io/docs/concepts/services-networking/service-traffic-policy, need to upgrade to Kubernetes 1.23.
And use external domains for each proxy, this way the videoplayback URL is correctly generated.
Not sure if this is going to work as nginx fetches the IP addresses and doesn't use the service IP address. Probably would want to force the service IP instead.
Fixed used:
Right now the streams URLs are generated from a random server and the server that will serve the videoplayback media will be random.
This break the protected streams URLs and could be the issue of the throttling.