Class: Creeper::Web

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Paginator
Defined in:
lib/creeper/web.rb

Instance Method Summary collapse

Methods included from Paginator

#page

Instance Method Details

#process_score(set, score, operation) ⇒ Object



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/creeper/web.rb', line 226

def process_score(set, score, operation)
  case operation
  when :retry
    raise "Not Implemented"
    Creeper.redis do |conn|
      results = conn.zrangebyscore(set, score, score)
      conn.zremrangebyscore(set, score, score)
      results.map do |message|
        msg = Creeper.load_json(message)
        msg['retry_count'] = msg['retry_count'] - 1
        conn.rpush("queue:#{msg['queue']}", Creeper.dump_json(msg))
      end
    end
  when :delete
    Creeper.redis do |conn|
      conn.zremrangebyscore(set, score, score)
    end
  end
end