Class: JobsDashboard::ClientMiddleware
- Inherits:
-
Object
- Object
- JobsDashboard::ClientMiddleware
- Includes:
- Storage
- Defined in:
- lib/jobs_dashboard/client_middleware.rb
Overview
Should be in the client middleware chain
Instance Method Summary collapse
-
#call(worker, msg, queue, redis_pool = nil) ⇒ Object
Uses msg id and puts :queued status in the job’s Redis hash.
-
#initialize(opts = {}) ⇒ ClientMiddleware
constructor
Parameterized initialization, use it when adding middleware to client chain chain.add JobsDashboard::ClientMiddleware.
Constructor Details
#initialize(opts = {}) ⇒ ClientMiddleware
Parameterized initialization, use it when adding middleware to client chain chain.add JobsDashboard::ClientMiddleware
13 14 15 |
# File 'lib/jobs_dashboard/client_middleware.rb', line 13 def initialize(opts = {}) @expiration = opts[:expiration] end |
Instance Method Details
#call(worker, msg, queue, redis_pool = nil) ⇒ Object
Uses msg id and puts :queued status in the job’s Redis hash
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jobs_dashboard/client_middleware.rb', line 22 def call(worker, msg, queue, redis_pool=nil) unless (msg)[:skip] store_for_id(msg['jid'], { item_type: msg['class'], retry: msg['retry'], queue: msg['queue'], args: msg['args'], status: 'queued' }) end yield end |