Skip to content

Commit

Permalink
Fix invalid logic for instance uptime comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
syeopite committed Dec 7, 2023
1 parent ac38c25 commit a84100f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/invidious/jobs/instance_refresh_job.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit a84100f

Please sign in to comment.