Module: Resque

Defined in:
lib/resque_latency.rb

Instance Method Summary collapse

Instance Method Details

#latency(queue) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/resque_latency.rb', line 25

def latency(queue)
	redis = Resque.redis
  l = redis.get("latency:#{queue}")

  return nil if l.nil?

  l = l.split(':').first.to_i

  return 0 if l <= 0

  l
end

#latency_updated_at(queue) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/resque_latency.rb', line 38

def latency_updated_at(queue)
	redis = Resque.redis
  l = redis.get("latency:#{queue}")

  return nil if l.nil?

  Time.at(l.split(':').last.to_i)
end