Module: Axn::Async::Adapters::Disabled
- Defined in:
- lib/axn/async/adapters/disabled.rb
Class Method Summary collapse
Class Method Details
._running_in_background? ⇒ Boolean
7 8 9 |
# File 'lib/axn/async/adapters/disabled.rb', line 7 def self._running_in_background? false end |
.included(base) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/axn/async/adapters/disabled.rb', line 11 def self.included(base) base.class_eval do # Validate that kwargs are not provided for Disabled adapter raise ArgumentError, "Disabled adapter does not accept configuration options." if _async_config&.any? raise ArgumentError, "Disabled adapter does not accept configuration block." if _async_config_block # Exception to the adapter pattern: Disabled adapter overrides call_async directly # to raise immediately without emitting notifications or logging. # Other adapters must NOT override call_async and should only implement _enqueue_async_job. def self.call_async(**kwargs) # Remove _async parameter to avoid confusion in error message kwargs.delete(:_async) # Don't emit notification or log - just raise immediately raise NotImplementedError, "Async execution is explicitly disabled for #{name}. " \ "Use `async :sidekiq` or `async :active_job` to enable background processing." end def self._enqueue_async_job(kwargs) # This should never be called since call_async raises, but define it for completeness raise NotImplementedError, "Async execution is explicitly disabled for #{name}. " \ "Use `async :sidekiq` or `async :active_job` to enable background processing." end end end |