mirror of
https://github.com/neocities/neocities.git
synced 2025-07-20 17:46:05 +02:00
Use http.rb to ensure timeout enforcement for cache purging, disable crashing flag for now
This commit is contained in:
parent
c3ea1fc9e4
commit
80b3f6b0be
3 changed files with 11 additions and 16 deletions
|
@ -22,17 +22,14 @@ class PurgeCacheWorker
|
|||
retry_encoded = false
|
||||
|
||||
begin
|
||||
RestClient::Request.execute method: :head, url: url, timeout: HTTP_TIMEOUT, headers: {
|
||||
host: URI::encode("#{username}.neocities.org"),
|
||||
cache_purge: '1'
|
||||
}
|
||||
HTTP.timeout(read: 10, write: 10, connect: 2).
|
||||
headers(host: URI::encode("#{username}.neocities.org"), cache_purge: '1').
|
||||
head(url)
|
||||
rescue URI::InvalidURIError
|
||||
raise if retry_encoded == true
|
||||
url = URI.encode url
|
||||
retry_encoded = true
|
||||
retry
|
||||
rescue RestClient::ResourceNotFound
|
||||
rescue RestClient::Forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue