Module: Sidekiq::Extensions

Defined in:
lib/sidekiq/delay.rb,
lib/sidekiq/extensions/action_mailer.rb,
lib/sidekiq/extensions/active_record.rb,
lib/sidekiq/extensions/class_methods.rb,
lib/sidekiq/extensions/generic_proxy.rb

Defined Under Namespace

Modules: ActionMailer, ActiveRecord, Klass, PsychAutoload Classes: DelayedClass, DelayedMailer, DelayedModel, Proxy

Constant Summary collapse

SIZE_LIMIT =
8_192

Class Method Summary collapse

Class Method Details

.enable_delay!Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sidekiq/delay.rb', line 5

def self.enable_delay!
  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
      include Sidekiq::Extensions::ActiveRecord
    end
    ActiveSupport.on_load(:action_mailer) do
      extend Sidekiq::Extensions::ActionMailer
    end
  end

  require 'sidekiq/extensions/class_methods'
  Module.__send__(:include, Sidekiq::Extensions::Klass)
end