Fix some timeouts when searching URLs by limiting some database queries (#13253)
Only look up private toots from database if the request failed because of 401, 403 or 404 errors, as those may indicate a private toot, rather than something that isn't a toot or cannot be processed.
This commit is contained in:
parent
bea0bb39d6
commit
cb12a2cdd3
2 changed files with 11 additions and 2 deletions
|
@ -5,6 +5,8 @@ class FetchResourceService < BaseService
|
|||
|
||||
ACCEPT_HEADER = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams", text/html;q=0.1'
|
||||
|
||||
attr_reader :response_code
|
||||
|
||||
def call(url)
|
||||
return if url.blank?
|
||||
|
||||
|
@ -27,6 +29,7 @@ class FetchResourceService < BaseService
|
|||
end
|
||||
|
||||
def process_response(response, terminal = false)
|
||||
@response_code = response.code
|
||||
return nil if response.code != 200
|
||||
|
||||
if ['application/activity+json', 'application/ld+json'].include?(response.mime_type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue