mirror of
https://github.com/iv-org/instances-api.git
synced 2024-10-01 04:35:38 -04:00
Add error handling for pulling monitors
This commit is contained in:
parent
e94bb4fa4a
commit
71dbbcb266
@ -35,16 +35,19 @@ spawn do
|
||||
loop do
|
||||
begin
|
||||
response = JSON.parse(HTTP::Client.get(URI.parse("https://uptime.invidio.us/api/getMonitorList/89VnzSKAn?page=#{page}")).body)
|
||||
|
||||
monitors += response["psp"]["monitors"].as_a
|
||||
page += 1
|
||||
|
||||
if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
|
||||
break
|
||||
end
|
||||
rescue ex
|
||||
error_message = response.try &.["errorStats"]?
|
||||
error_message ||= ex.message
|
||||
puts "Exception pulling monitors: #{error_message}"
|
||||
next
|
||||
end
|
||||
|
||||
monitors += response["psp"]["monitors"].as_a
|
||||
page += 1
|
||||
|
||||
if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/wiki/omarroth/invidious/Invidious-Instances.md")).body
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<link rel="stylesheet" href="/css/pure-min.css" />
|
||||
<link rel="stylesheet" href="/css/base-min.css" />
|
||||
<link rel="stylesheet" href="/css/tables-min.css" />
|
||||
<title>Invidious Instances</title>
|
||||
<style>
|
||||
|
Loading…
Reference in New Issue
Block a user