Fix invalid logic for instance uptime comparison

This commit is contained in:
syeopite 2023-12-07 11:43:44 -08:00
parent 41c978d350
commit aa96cf3453
No known key found for this signature in database
GPG key ID: A73C186DA3955A1A

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