rosa-build/config/initializers/redis.rb

13 lines
325 B
Ruby
Raw Normal View History

class Redis
def self.connect!
2016-04-29 15:10:30 +01:00
url = ENV["REDIS_URL"] || "redis://localhost:6379/#{::Rails.env.test? ? 2 : 0}"
opts = { url: url }
opts[:logger] = ::Rails.logger if ::Rails.application.config.log_redis
Redis.current = Redis.new(opts)
end
end
Redis.connect!
2016-04-29 15:10:30 +01:00
Redis::Semaphore.new(:job_shift_lock).delete!