diff --git a/lib/sidekiq.rb b/lib/sidekiq.rb index 6bed67b9..abea7d31 100644 --- a/lib/sidekiq.rb +++ b/lib/sidekiq.rb @@ -196,6 +196,15 @@ module Sidekiq raise ArgumentError, "Invalid event name: #{event}" unless options[:lifecycle_events].key?(event) options[:lifecycle_events][event] << block end + + # We are shutting down Sidekiq but what about workers that + # are working on some long job? This error is + # raised in workers that have not finished within the hard + # timeout limit. This is needed to rollback db transactions, + # otherwise Ruby's Thread#kill will commit. See #377. + # DO NOT RESCUE THIS ERROR IN YOUR WORKERS + class Shutdown < Interrupt; end + end require 'sidekiq/extensions/class_methods' diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 8ee0b87a..9929e8d3 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -11,14 +11,6 @@ require 'sidekiq' require 'sidekiq/util' module Sidekiq - # We are shutting down Sidekiq but what about workers that - # are working on some long job? This error is - # raised in workers that have not finished within the hard - # timeout limit. This is needed to rollback db transactions, - # otherwise Ruby's Thread#kill will commit. See #377. - # DO NOT RESCUE THIS ERROR. - class Shutdown < Interrupt; end - class CLI include Util include Singleton unless $TESTING