Use shared connection error array in stoplight handlers

This commit is contained in:
Matt Jankowski 2024-10-14 06:54:54 -04:00
parent 2404d6d1a1
commit 764b044e02
3 changed files with 3 additions and 3 deletions

View File

@ -242,7 +242,7 @@ module SignatureVerification
Stoplight("source:#{request.remote_ip}")
.with_threshold(1)
.with_cool_off_time(5.minutes.seconds)
.with_error_handler { |error, handle| error.is_a?(HTTP::Error) || error.is_a?(OpenSSL::SSL::SSLError) ? handle.call(error) : raise(error) }
.with_error_handler { |error, handle| Mastodon::HTTP_CONNECTION_ERRORS.any? { |error_class| error.is_a?(error_class) } ? handle.call(error) : raise(error) }
end
def actor_refresh_key!(actor)

View File

@ -57,7 +57,7 @@ class BulkImportRowService
.with_fallback { nil }
.with_threshold(1)
.with_cool_off_time(5.minutes.seconds)
.with_error_handler { |error, handle| error.is_a?(HTTP::Error) || error.is_a?(OpenSSL::SSL::SSLError) ? handle.call(error) : raise(error) }
.with_error_handler { |error, handle| Mastodon::HTTP_CONNECTION_ERRORS.any? { |error_class| error.is_a?(error_class) } ? handle.call(error) : raise(error) }
else
Stoplight('domain-blank')
end

View File

@ -49,7 +49,7 @@ class Import::RelationshipWorker
.with_fallback { nil }
.with_threshold(1)
.with_cool_off_time(5.minutes.seconds)
.with_error_handler { |error, handle| error.is_a?(HTTP::Error) || error.is_a?(OpenSSL::SSL::SSLError) ? handle.call(error) : raise(error) }
.with_error_handler { |error, handle| Mastodon::HTTP_CONNECTION_ERRORS.any? { |error_class| error.is_a?(error_class) } ? handle.call(error) : raise(error) }
else
Stoplight('domain-blank')
end