class SidekiqSpy::Spy::Workers

Public Class Methods

new() click to toggle source
# File lib/sidekiq-spy/spy/workers.rb, line 11
def initialize
  @workers = Sidekiq::Workers.new
  
  refresh
end

Public Instance Methods

refresh() click to toggle source
# File lib/sidekiq-spy/spy/workers.rb, line 17
def refresh
  h = []
  
  @workers.each do |worker, msg|
    h << {
      :name       => worker,
      :queue      => msg['queue'],
      :class      => msg['payload']['class'],
      :args       => msg['payload']['args'],
      :started_at => (msg['run_at'].is_a?(Numeric) ? Time.at(msg['run_at']) : Time.parse(msg['run_at'])),
    }
  end
  
  @data = h
end