mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 14:06:21 +00:00
fix: activejob gestiona errores por su cuenta
closes #15351 closes #15352 closes #15612 closes #15618 closes #15621 closes #15622 closes #15623 closes #15729 closes #15730 closes #15731 closes #15735 closes #15736 closes #15776 closes #15824 closes #15827 closes #15828 closes #15829 closes #15830 closes #15831 closes #15832 closes #15838 closes #15839 closes #15882
This commit is contained in:
parent
ca4017dbd0
commit
3f7f887841
1 changed files with 8 additions and 17 deletions
|
@ -19,25 +19,16 @@ class ActivityPub
|
||||||
#
|
#
|
||||||
# @param error [Exception]
|
# @param error [Exception]
|
||||||
# @return [Bool]
|
# @return [Bool]
|
||||||
def handle_error(error)
|
discard_on(FastJsonparser::ParseError) do |error|
|
||||||
case error
|
ExceptionNotifier.notify_exception(error, data: { site: site.name, object: object.uri, body: response.body })
|
||||||
when FastJsonparser::ParseError
|
|
||||||
expire
|
|
||||||
|
|
||||||
ExceptionNotifier.notify_exception(error, data: { site: site.name, object: object.uri, body: response.body })
|
|
||||||
|
|
||||||
false
|
|
||||||
when ActiveRecord::RecordInvalid, SocketError, SystemCallError, Net::OpenTimeout, OpenSSL::OpenSSLError
|
|
||||||
retry_in(ApplicationJob.random_wait)
|
|
||||||
|
|
||||||
false
|
|
||||||
else
|
|
||||||
expire
|
|
||||||
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
retry_on ActiveRecord::RecordInvalid
|
||||||
|
retry_on SocketError, wait: ApplicationJob.random_wait
|
||||||
|
retry_on SystemCallError, wait: ApplicationJob.random_wait
|
||||||
|
retry_on Net::OpenTimeout, wait: ApplicationJob.random_wait
|
||||||
|
retry_on OpenSSL::OpenSSLError, wait: ApplicationJob.random_wait
|
||||||
|
|
||||||
def perform(site:, object_id:)
|
def perform(site:, object_id:)
|
||||||
ActivityPub::Object.transaction do
|
ActivityPub::Object.transaction do
|
||||||
@site = site
|
@site = site
|
||||||
|
|
Loading…
Reference in a new issue