Currently, Rage::Deferred automatically retries failed tasks up to 5 times using exponential backoff. However, this retry count is hardcoded and cannot be customized. Additionally, there is no way to specify which exceptions should trigger a retry.
The goal of this issue is to allow users to configure retry behavior per task:
For example:
class SyncWithExternalService
include Rage::Deferred::Task
retry_on Net::OpenTimeout, Net::ReadTimeout, attempts: 10
# or
retry_on attempts: 3
def perform(user_id:)
# ...
end
end
Rage::Deferred works.5 is used and how exponential backoff is applied.retry_on is not specified (the current behavior of 5 retries on all exceptions should be preserved for backward compatibility).