1
0
Fork 0
forked from Fijxu/invidious

Fix invalid logic for instance uptime comparison

This commit is contained in:
syeopite 2023-12-07 11:43:44 -08:00 committed by Fijxu
parent 24f878e6f6
commit 532d92bb7a
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -69,7 +69,7 @@ class Invidious::Jobs::InstanceListRefreshJob < Invidious::Jobs::BaseJob
raw_instance_list = JSON.parse(instance_api_client.get("/instances.json").body).as_a
instance_api_client.close
rescue Socket::ConnectError | IO::TimeoutError | JSON::ParseException
rescue ex : Socket::ConnectError | IO::TimeoutError | JSON::ParseException
raw_instance_list = [] of JSON::Any
end
@ -89,9 +89,9 @@ class Invidious::Jobs::InstanceListRefreshJob < Invidious::Jobs::BaseJob
# Checks if the uptime of the target instance is greater than 90% over a 30 day period
private def bad_uptime?(target_instance_health_monitor) : Bool
return false if !target_instance_health_monitor["statusClass"] == "success"
return false if target_instance_health_monitor["30dRatio"]["ratio"].as_s.to_f < 90
return true if !target_instance_health_monitor["statusClass"] == "success"
return true if target_instance_health_monitor["30dRatio"]["ratio"].as_s.to_f < 90
return true
return false
end
end