Class: UniqueJob::ClientMiddleware
- Inherits:
-
Object
- Object
- UniqueJob::ClientMiddleware
- Includes:
- Util
- Defined in:
- lib/unique_job/client_middleware.rb
Instance Method Summary collapse
- #call(worker_str, job, queue, redis_pool, &block) ⇒ Object
-
#initialize(redis_options) ⇒ ClientMiddleware
constructor
A new instance of ClientMiddleware.
Methods included from Util
Methods included from Logging
Constructor Details
permalink #initialize(redis_options) ⇒ ClientMiddleware
Returns a new instance of ClientMiddleware.
7 8 9 10 |
# File 'lib/unique_job/client_middleware.rb', line 7 def initialize() @history = JobHistory.new(self.class.name, Redis.new()) @context = 'Client' end |
Instance Method Details
permalink #call(worker_str, job, queue, redis_pool, &block) ⇒ Object
[View source]
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/unique_job/client_middleware.rb', line 12 def call(worker_str, job, queue, redis_pool, &block) if job.has_key?('at') # perform_in or perform_at yield else if worker_str.class == String worker = worker_str.constantize.new # Sidekiq < 6 else worker = worker_str.new end perform(worker, job, &block) end end |