Prevent exceptions caused by Sidekiq::Shutdown from causing jobs to be retried.

Jobs in progress during a Sidekiq shutdown/restart are requeued for immediate execution. They should not also be queued for retry.

This is an attempt at a cleaner fix than that proposed with mperham#1354, also discussed on mperham#897. Because it depends on Exception#cause, this fix will only be effective on Ruby 2.1.0; however, the code will run on earlier Rubies.
Merge pull request #1805 from avalancheau/fix-activerecord-retry-on-restart

Prevent exceptions caused by Sidekiq::Shutdown from causing jobs to be retried