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,9 +35,6 @@ spawn do
|
||||||
loop do
|
loop do
|
||||||
begin
|
begin
|
||||||
response = JSON.parse(HTTP::Client.get(URI.parse("https://uptime.invidio.us/api/getMonitorList/89VnzSKAn?page=#{page}")).body)
|
response = JSON.parse(HTTP::Client.get(URI.parse("https://uptime.invidio.us/api/getMonitorList/89VnzSKAn?page=#{page}")).body)
|
||||||
rescue ex
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
monitors += response["psp"]["monitors"].as_a
|
monitors += response["psp"]["monitors"].as_a
|
||||||
page += 1
|
page += 1
|
||||||
|
@ -45,6 +42,12 @@ spawn do
|
||||||
if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
|
if response["psp"]["perPage"].as_i * page > response["psp"]["totalMonitors"].as_i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
rescue ex
|
||||||
|
error_message = response.try &.["errorStats"]?
|
||||||
|
error_message ||= ex.message
|
||||||
|
puts "Exception pulling monitors: #{error_message}"
|
||||||
|
next
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/wiki/omarroth/invidious/Invidious-Instances.md")).body
|
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 charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="referrer" content="no-referrer" />
|
<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" />
|
<link rel="stylesheet" href="/css/tables-min.css" />
|
||||||
<title>Invidious Instances</title>
|
<title>Invidious Instances</title>
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in a new issue