def perform
refund_log = {
success: refund_retry.success?,
amount: refund_amount,
action: "refund"
}
if refund_retry.success?
refund_log[:reference] = refund_retry.transaction.id
refund_log[:message] = refund_retry.transaction.status
else
refund_log[:message] = refund_retry.message
refund_log[:params] = {}
refund_retry.errors.each do |error|
refund_log[:params][error.code] = error.message
end
order_transaction.message = refund_log[:params].values.join('|')
raise "delayed RefundJob has failed"
end
end
當我在else語句中引發「延遲RefundJob失敗」,它創建一個Airbrake。如果它在else部分結束,我想再次運行該作業。延遲創建Airbrakes每次它引發錯誤
有什麼辦法可以在不引發異常的情況下重新排隊工作嗎?並防止創建一個airbrake?
我使用delayed_job的版本1.
謝謝您的詳細解答。關於重新安排方法,我的印象是當工作失敗時重新安排時間(如果我沒有提出錯誤,我會通過)。我在這裏糾正了嗎? –