Sha256: 206f9938878b441699b5c07ec10bfb5497208bb7b02a8225b4594d8c051ce333
Contents?: true
Size: 800 Bytes
Versions: 2
Compression:
Stored size: 800 Bytes
Contents
module QPush module Server module Apis # The Delay API will take a job and add it to the delay sorted set. # class Delay < Base def initialize(job, type) @job = job @type = type end def call load_type delay_job end private def delay_job Server.redis do |conn| conn.hincrby(Server.keys.stats, @stat, 1) conn.zadd(Server.keys.delay, @time, @job.to_json) end end def load_type case @type when :delay @stat = 'delayed' @time = @job.delay_until when :retry @stat = 'retries' @time = @job.retry_at end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.7 | lib/qpush/server/apis/delay.rb |
qpush-0.1.6 | lib/qpush/server/apis/delay.rb |