mirror of
https://gitea.invidious.io/iv-org/instances-api.git
synced 2024-08-15 00:53:15 +00:00
Add error handling for pulling monitors
This commit is contained in:
parent
e94bb4fa4a
commit
71dbbcb266
2 changed files with 11 additions and 8 deletions
|
@ -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 a new issue