mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Promote Shutdown exception into main module
This commit is contained in:
parent
8bc677f655
commit
3e207106c1
2 changed files with 9 additions and 8 deletions
|
@ -196,6 +196,15 @@ module Sidekiq
|
||||||
raise ArgumentError, "Invalid event name: #{event}" unless options[:lifecycle_events].key?(event)
|
raise ArgumentError, "Invalid event name: #{event}" unless options[:lifecycle_events].key?(event)
|
||||||
options[:lifecycle_events][event] << block
|
options[:lifecycle_events][event] << block
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
require 'sidekiq/extensions/class_methods'
|
require 'sidekiq/extensions/class_methods'
|
||||||
|
|
|
@ -11,14 +11,6 @@ require 'sidekiq'
|
||||||
require 'sidekiq/util'
|
require 'sidekiq/util'
|
||||||
|
|
||||||
module Sidekiq
|
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
|
class CLI
|
||||||
include Util
|
include Util
|
||||||
include Singleton unless $TESTING
|
include Singleton unless $TESTING
|
||||||
|
|
Loading…
Add table
Reference in a new issue