Class: Sidekiq::Web

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/sidekiq/web.rb

Instance Method Summary collapse

Instance Method Details

#process_score(score, operation) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/sidekiq/web.rb', line 169

def process_score(score, operation)
  case operation
  when :retry
    Sidekiq.redis do |conn|
      results = conn.zrangebyscore('retry', score, score)
      conn.zremrangebyscore('retry', score, score)
      results.map do |message|
        msg = Sidekiq.load_json(message)
        conn.rpush("queue:#{msg['queue']}", message)
      end
    end
  when :delete
    Sidekiq.redis do |conn|
      conn.zremrangebyscore('retry', score, score)
    end
  end
end