2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-03 07:55:56 +08:00
|
|
|
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
2013-03-11 20:33:20 +08:00
|
|
|
puts "Flushing redis (development mode)"
|
2020-05-23 12:56:13 +08:00
|
|
|
Discourse.redis.flushdb
|
|
|
|
end
|
2020-06-16 12:53:04 +08:00
|
|
|
|
|
|
|
# Pending https://github.com/MiniProfiler/rack-mini-profiler/pull/450 and
|
|
|
|
# upgrade to Sidekiq 6.1
|
|
|
|
Redis.exists_returns_integer = true
|
2022-02-15 21:36:07 +08:00
|
|
|
|
2022-02-15 23:25:22 +08:00
|
|
|
begin
|
|
|
|
if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0")
|
|
|
|
STDERR.puts "Discourse requires Redis 6.2.0 or up"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
rescue Redis::CannotConnectError
|
|
|
|
STDERR.puts "Couldn't connect to Redis"
|
2022-02-15 21:36:07 +08:00
|
|
|
end
|