FIX: Redis may not be availiable on Redis initializer (#15955)

This commit is contained in:
Rafael dos Santos Silva 2022-02-15 12:25:22 -03:00 committed by GitHub
parent 2644813c99
commit d83da596be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@ To get your environment setup, follow the community setup guide for your operati
If you're familiar with how Rails works and are comfortable setting up your own environment, you can also try out the [**Discourse Advanced Developer Guide**](docs/DEVELOPER-ADVANCED.md), which is aimed primarily at Ubuntu and macOS environments.
Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.0+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first!
Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.2+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first!
## Setting up Discourse

View File

@ -9,7 +9,11 @@ end
# upgrade to Sidekiq 6.1
Redis.exists_returns_integer = true
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
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"
end