Class: Sidekiq::History::Middleware
- Inherits:
-
Object
- Object
- Sidekiq::History::Middleware
- Includes:
- Util
- Defined in:
- lib/sidekiq/history/middleware.rb
Instance Attribute Summary collapse
-
#msg ⇒ Object
Returns the value of attribute msg.
Instance Method Summary collapse
Instance Attribute Details
#msg ⇒ Object
Returns the value of attribute msg.
8 9 10 |
# File 'lib/sidekiq/history/middleware.rb', line 8 def msg @msg end |
Instance Method Details
#call(worker, msg, queue) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sidekiq/history/middleware.rb', line 10 def call(worker, msg, queue) self.msg = msg data = { started_at: Time.now.utc, payload: msg, worker: msg['class'], processor: "#{identity}-#{Thread.current.object_id}", queue: queue } Sidekiq.redis do |conn| conn.lpush(LIST_KEY, Sidekiq.dump_json(data)) unless Sidekiq.history_max_count == false conn.ltrim(LIST_KEY, 0, Sidekiq.history_max_count - 1) end end yield end |