mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Update how delayed extensions are loaded, fixes #3509
This commit is contained in:
parent
980438c61d
commit
ad98a32cbc
2 changed files with 24 additions and 3 deletions
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
[Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
|
[Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
|
||||||
|
|
||||||
HEAD
|
5.0.3
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
- Fix overriding `class_attribute` core extension from ActiveSupport with Sidekiq one [PikachuEXE, #3499]
|
- Fix overriding `class_attribute` core extension from ActiveSupport with Sidekiq one [PikachuEXE, #3499]
|
||||||
- Allow job logger to be overridden [AlfonsoUceda, #3502]
|
- Allow job logger to be overridden [AlfonsoUceda, #3502]
|
||||||
|
- Set a default Redis client identifier for debugging [#3516]
|
||||||
|
- Fix "Uninitialized constant" errors on startup with the delayed extensions [#3509]
|
||||||
|
|
||||||
5.0.2
|
5.0.2
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -3,12 +3,17 @@ module Sidekiq
|
||||||
|
|
||||||
def self.enable_delay!
|
def self.enable_delay!
|
||||||
if defined?(::ActiveSupport)
|
if defined?(::ActiveSupport)
|
||||||
|
require 'sidekiq/extensions/active_record'
|
||||||
|
require 'sidekiq/extensions/action_mailer'
|
||||||
|
|
||||||
|
# Need to patch Psych so it can autoload classes whose names are serialized
|
||||||
|
# in the delayed YAML.
|
||||||
|
Psych::Visitors::ToRuby.prepend(Sidekiq::Extensions::PsychAutoload)
|
||||||
|
|
||||||
ActiveSupport.on_load(:active_record) do
|
ActiveSupport.on_load(:active_record) do
|
||||||
require 'sidekiq/extensions/active_record'
|
|
||||||
include Sidekiq::Extensions::ActiveRecord
|
include Sidekiq::Extensions::ActiveRecord
|
||||||
end
|
end
|
||||||
ActiveSupport.on_load(:action_mailer) do
|
ActiveSupport.on_load(:action_mailer) do
|
||||||
require 'sidekiq/extensions/action_mailer'
|
|
||||||
extend Sidekiq::Extensions::ActionMailer
|
extend Sidekiq::Extensions::ActionMailer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,5 +22,19 @@ module Sidekiq
|
||||||
Module.__send__(:include, Sidekiq::Extensions::Klass)
|
Module.__send__(:include, Sidekiq::Extensions::Klass)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module PsychAutoload
|
||||||
|
def resolve_class(klass_name)
|
||||||
|
# constantize
|
||||||
|
names = klass_name.split('::')
|
||||||
|
names.shift if names.empty? || names.first.empty?
|
||||||
|
|
||||||
|
names.inject(Object) do |constant, name|
|
||||||
|
constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
||||||
|
end
|
||||||
|
rescue NameError
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue