Catch dead servers in archive bookmark job

This commit is contained in:
2024-03-03 19:46:15 +11:00
parent a682f05c3f
commit 413f2e2b3e
3 changed files with 8 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ gem "hanami-validations", "2.1.0"
gem "hanami-assets", "2.1.0"
gem "hanami-view", "2.1.0"
gem "csv"
gem "rom-sql"
gem "pg"
gem "scraperd", github: "dNitza/scraperd", branch: "master"

View File

@@ -68,6 +68,7 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
csv (3.2.8)
database_cleaner-core (2.0.1)
database_cleaner-sequel (2.0.2)
database_cleaner-core (~> 2.0.0)
@@ -330,7 +331,7 @@ GEM
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pg (1.5.5)
pg (1.5.6)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
@@ -441,7 +442,7 @@ GEM
nokogiri (>= 1.12.0)
sentry-ruby (5.16.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
sequel (5.77.0)
sequel (5.78.0)
bigdecimal
shellany (0.0.1)
simple-rss (1.3.3)
@@ -510,6 +511,7 @@ DEPENDENCIES
capistrano-systemd-multiservice
capistrano3-puma!
connection_pool
csv
database_cleaner-sequel
dotenv
down

View File

@@ -1,5 +1,6 @@
require "httparty"
require "que"
require "net/http"
module Adamantium
module Jobs
@@ -14,6 +15,8 @@ module Adamantium
if code >= 400
bookmark_repo.update(id: bookmark.id, params: {url: "https://web.archive.org/web/*/#{bookmark.url}"})
end
rescue Net::OpenTimeout
bookmark_repo.update(id: bookmark.id, params: {url: "https://web.archive.org/web/*/#{bookmark.url}"})
end
end
end