Module: Sidekiq::Batch::Jobs
- Defined in:
- lib/sidekiq/batch/jobs.rb,
lib/sidekiq/batch/jobs/engine.rb,
lib/sidekiq/batch/jobs/version.rb,
lib/generators/sidekiq/batch/jobs/install/install_generator.rb
Overview
rubocop:disable Style/Documentation
Defined Under Namespace
Modules: Generators Classes: Engine, Error
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.auto_install ⇒ Object
Returns the value of attribute auto_install.
Class Method Summary collapse
- .disable_auto_install! ⇒ Object
-
.install! ⇒ Object
Idempotent — guarded by an installed flag so calling twice (auto-install plus an explicit call in specs, for example) doesn’t double-register middleware or death handlers.
-
.reset_installed! ⇒ Object
For tests: forget that install! has run.
Class Attribute Details
.auto_install ⇒ Object
Returns the value of attribute auto_install.
13 14 15 |
# File 'lib/sidekiq/batch/jobs.rb', line 13 def auto_install @auto_install end |
Class Method Details
.disable_auto_install! ⇒ Object
17 18 19 |
# File 'lib/sidekiq/batch/jobs.rb', line 17 def self.disable_auto_install! self.auto_install = false end |
.install! ⇒ Object
Idempotent — guarded by an installed flag so calling twice (auto-install plus an explicit call in specs, for example) doesn’t double-register middleware or death handlers.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sidekiq/batch/jobs.rb', line 24 def self.install! return if @installed ::Sidekiq.configure_client do |config| config.client_middleware { |chain| chain.prepend ::SidekiqBatch::ClientMiddleware } end ::Sidekiq.configure_server do |config| config.client_middleware { |chain| chain.prepend ::SidekiqBatch::ClientMiddleware } config.server_middleware { |chain| chain.add ::SidekiqBatch::Middleware } config.death_handlers << ->(job, ex) { ::SidekiqBatch::Middleware.handle_death(job, ex) } end @installed = true end |
.reset_installed! ⇒ Object
For tests: forget that install! has run.
41 42 43 |
# File 'lib/sidekiq/batch/jobs.rb', line 41 def self.reset_installed! @installed = false end |