module QueueManager::Util

Public Class Methods

included(base) click to toggle source
# File lib/queue_manager/util.rb, line 3
def self.included(base)
  base.extend self
end

Private Instance Methods

config() click to toggle source
# File lib/queue_manager/util.rb, line 23
def config
  QueueManager.config
end
logger() click to toggle source
# File lib/queue_manager/util.rb, line 27
def logger
  QueueManager.logger
end
redis() click to toggle source
# File lib/queue_manager/util.rb, line 9
def redis
  $redis ||= ::Redis.new(url: config.redis_connection_string)
end
timestamp() click to toggle source
# File lib/queue_manager/util.rb, line 13
def timestamp
  redis.time[0].to_i
end
transaction(&block) click to toggle source
# File lib/queue_manager/util.rb, line 17
def transaction(&block)
  redis.watch(config.queue)
  block.call
  redis.unwatch
end