Sha256: 2321f8b30d2da6a0ceda939c8aca34fa3348b52b88a110acfa77bd86d660b8b1
Contents?: true
Size: 838 Bytes
Versions: 1
Compression:
Stored size: 838 Bytes
Contents
module QPush module Web module Apis class Retries def initialize(start, count) @start = start ? start.to_i : 0 @count = count ? count.to_i : 10 @jobs = nil end def call retrieve_jobs update_jobs trim_jobs end private def retrieve_jobs @jobs = Web.redis do |conn| conn.zrange(QPush.keys.delay, 0, -1, with_scores: true) end end def update_jobs @jobs.map! do |job| hash = JSON.parse(job.first, symbolize_names: true).merge(perform_at: job.last) next unless hash[:failed] hash end end def trim_jobs @jobs.compact! @jobs[@start, @count] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.6 | lib/qpush/web/apis/retries.rb |