extract attempt_retry method in RetryJobs middleware

I built [sidekiq-retries](https://github.com/govdelivery/sidekiq-retries) to avoid retrying jobs in certain scenarios (but still have the exception bubble up so sidekiq-failures records it). The logic in the RetryJobs middleware can't be easily invoked by a subclass; I had just been cutting-and-pasting as the logic changed, but that's kind of sketchy and causes stuff like https://github.com/govdelivery/sidekiq-retries/pull/4.

So I'd like to have this code somewhere where I can use it instead of my (possibly-wrong) duplicate. I put it into a private method so I can get at it from my subclass, but would be cool with making it more API-esque if it seems worthwhile.