Skip to content

Commit

Permalink
Promote Shutdown exception into main module
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Oct 10, 2015
1 parent 8bc677f commit 3e20710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions lib/sidekiq.rb
Expand Up @@ -196,6 +196,15 @@ def self.on(event, &block)
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'
Expand Down
8 changes: 0 additions & 8 deletions lib/sidekiq/cli.rb
Expand Up @@ -11,14 +11,6 @@
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
Expand Down

0 comments on commit 3e20710

Please sign in to comment.