mirror of
https://gitea.invidious.io/iv-org/instances-api.git
synced 2024-08-15 00:53:15 +00:00
Update timeout for uptime monitors
This commit is contained in:
parent
51c67b3da6
commit
5a7ba726c9
1 changed files with 6 additions and 4 deletions
|
@ -34,7 +34,10 @@ spawn do
|
||||||
page = 1
|
page = 1
|
||||||
loop do
|
loop do
|
||||||
begin
|
begin
|
||||||
response = JSON.parse(HTTP::Client.get(URI.parse("https://uptime.invidio.us/api/getMonitorList/89VnzSKAn?page=#{page}")).body)
|
client = HTTP::Client.new(URI.parse("https://uptime.invidio.us"))
|
||||||
|
client.connect_timeout = 10.seconds
|
||||||
|
client.read_timeout = 10.seconds
|
||||||
|
response = JSON.parse(client.get("/api/getMonitorList/89VnzSKAn?page=#{page}").body)
|
||||||
|
|
||||||
monitors += response["psp"]["monitors"].as_a
|
monitors += response["psp"]["monitors"].as_a
|
||||||
page += 1
|
page += 1
|
||||||
|
@ -46,7 +49,6 @@ spawn do
|
||||||
error_message = response.try &.["errorStats"]?
|
error_message = response.try &.["errorStats"]?
|
||||||
error_message ||= ex.message
|
error_message ||= ex.message
|
||||||
puts "Exception pulling monitors: #{error_message}"
|
puts "Exception pulling monitors: #{error_message}"
|
||||||
next
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,11 +77,11 @@ spawn do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
monitor = monitors.select { |monitor| monitor["name"].try &.as_s == host }[0]?
|
monitor = monitors.try &.select { |monitor| monitor["name"].try &.as_s == host }[0]?
|
||||||
INSTANCES[host] = {flag: flag, region: region, stats: stats, type: type, uri: uri.to_s, monitor: monitor}
|
INSTANCES[host] = {flag: flag, region: region, stats: stats, type: type, uri: uri.to_s, monitor: monitor}
|
||||||
end
|
end
|
||||||
|
|
||||||
sleep 1.minute
|
sleep 5.minutes
|
||||||
Fiber.yield
|
Fiber.yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue