Do not send a user without a cookie to a broken backend
Some checks failed
Invidious CI / build (push) Has been cancelled
Some checks failed
Invidious CI / build (push) Has been cancelled
This commit is contained in:
parent
adc5c73853
commit
3d276ad88c
1 changed files with 7 additions and 0 deletions
|
@ -43,6 +43,13 @@ module Invidious::Routes::BeforeAll
|
|||
current_companion = rand(CONFIG.invidious_companion.size)
|
||||
end
|
||||
|
||||
# Do not send a user without a cookie to a broken backend
|
||||
c = 0
|
||||
while (BackendInfo.get_status[current_companion] = 0) && c != CONFIG.invidious_companion.size
|
||||
current_companion += 1
|
||||
c +=1
|
||||
end
|
||||
|
||||
if current_companion > CONFIG.invidious_companion.size
|
||||
current_companion = current_companion % CONFIG.invidious_companion.size
|
||||
env.response.cookies[CONFIG.server_id_cookie_name] = Invidious::User::Cookies.server_id(env.request.headers["Host"], current_companion)
|
||||
|
|
Loading…
Add table
Reference in a new issue