Module: Interactor::SidekiqWorker
- Defined in:
- lib/interactor/sidekiq.rb
Overview
based on Sidekiq 4.x #delay method, which is not enabled by default in Sidekiq 5.x github.com/mperham/sidekiq/blob/4.x/lib/sidekiq/extensions/generic_proxy.rb github.com/mperham/sidekiq/blob/4.x/lib/sidekiq/extensions/class_methods.rb
Defined Under Namespace
Classes: Worker
Instance Method Summary collapse
Instance Method Details
#async_call(context = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/interactor/sidekiq.rb', line 48 def async_call(context = {}) = (context) = (context) Worker.set().perform_in(.fetch(:delay, 0), handle_context_for_sidekiq(context)) new(context.to_h).context rescue Exception => e begin new(context.to_h).context.fail!(error: e.) rescue Failure => e e.context end end |
#sync_call(context = {}) ⇒ Object
44 45 46 |
# File 'lib/interactor/sidekiq.rb', line 44 def sync_call(context = {}) new(context).tap(&:run!).context end |