提交 743dba53 编写于 作者: J Jon Moss 提交者: GitHub

Merge pull request #26740 from y-yagi/update_retry_on_example

correct exception class in `retry_on` example [ci skip]
......@@ -16,13 +16,13 @@
class RemoteServiceJob < ActiveJob::Base
retry_on CustomAppException # defaults to 3s wait, 5 attempts
retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 }
retry_on ActiveRecord::StatementInvalid, wait: 5.seconds, attempts: 3
retry_on ActiveRecord::Deadlocked, wait: 5.seconds, attempts: 3
retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10
discard_on ActiveJob::DeserializationError
def perform(*args)
# Might raise CustomAppException or AnotherCustomAppException for something domain specific
# Might raise ActiveRecord::StatementInvalid when a local db deadlock is detected
# Might raise ActiveRecord::Deadlocked when a local db deadlock is detected
# Might raise Net::OpenTimeout when the remote service is down
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册