Class: SidekiqUniqueJobs::Client::Middleware

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
OptionsWithFallback
Defined in:
lib/sidekiq_unique_jobs/testing.rb,
lib/sidekiq_unique_jobs/client/middleware.rb

Instance Method Summary collapse

Methods included from OptionsWithFallback

included, #lock, #lock_cache, #lock_cache=, #lock_class, #lock_type, #lock_type_from, #log_duplicate_payload?, #options, #unique_disabled?, #unique_enabled?, #unique_lock

Instance Method Details

#_serverObject


61
62
63
# File 'lib/sidekiq_unique_jobs/testing.rb', line 61

def _server
  SidekiqUniqueJobs::Server::Middleware.new
end

#call(worker_class, item, queue, redis_pool = nil) ⇒ Object


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/sidekiq_unique_jobs/testing.rb', line 45

def call(worker_class, item, queue, redis_pool = nil)
  worker_class = SidekiqUniqueJobs.worker_class_constantize(worker_class)

  if Sidekiq::Testing.inline?
    call_real(worker_class, item, queue, redis_pool) do
      _server.call(worker_class.new, item, queue, redis_pool) do
        yield
      end
    end
  else
    call_real(worker_class, item, queue, redis_pool) do
      yield
    end
  end
end

#call_realObject


44
# File 'lib/sidekiq_unique_jobs/testing.rb', line 44

alias call_real call