extract attempt_retry method in RetryJobs middleware