2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-02 19:55:56 -04:00
|
|
|
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
2013-03-11 08:33:20 -04:00
|
|
|
puts "Flushing redis (development mode)"
|
2020-05-23 00:56:13 -04:00
|
|
|
Discourse.redis.flushdb
|
|
|
|
end
|
2020-06-16 00:53:04 -04: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 08:36:07 -05:00
|
|
|
|
2022-02-15 10:25:22 -05: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 08:36:07 -05:00
|
|
|
end
|